Database imports fail for predictable reasons. NOT NULL constraint violations, data type mismatches, primary key conflicts, string truncation, and referential integrity errors account for the vast majority of import failures. Every one of them is detectable before you run the import — if you know what to check.
1. Null Values in Required Columns
Before importing, identify which columns in your target table have NOT NULL constraints. Then check whether your CSV has any blank cells in those columns. A single blank value in a required field will cause the entire batch (or the entire import, depending on your error handling) to fail.
Count the nulls per column across your entire dataset. If a required column has even one blank, decide how to handle it: fill with a default value, exclude the row, or fix the source data.
2. Data Type Mismatches
A column defined as INTEGER will reject the value "N/A". A DATE column will reject "TBD". A DECIMAL(10,2) column will reject values like "~1,500" or "approx. 2000".
Scan every column that has a strict type in the target table and check for values that don't conform. Common problems: date columns with mixed formats (some MM/DD/YYYY, some YYYY-MM-DD), number columns with currency symbols or commas as thousands separators, boolean columns with values like "Yes"/"No" instead of 1/0 or TRUE/FALSE.
3. Duplicate Primary Keys
If your CSV contains rows that share a primary key value, the import will either fail (with a duplicate key error) or silently overwrite existing records (with UPSERT semantics), depending on your import method. Neither outcome is what you usually want from a bulk import.
Deduplicate on the primary key column before importing. Confirm that every value in the primary key column is unique.
4. String Length Violations
A VARCHAR(50) column rejects any value longer than 50 characters. This catches you off guard with long email domains, verbose product descriptions, or concatenated fields that exceed the defined limit.
Check the maximum character length in each text column and compare it to the column definition in your target schema. Flag any values that exceed the limit.
5. Referential Integrity — Foreign Key Violations
If your CSV contains a foreign key column (like customer_id or product_id), every value in that column must exist in the referenced table. An import of orders records where some customer_ids don't exist in the customers table will fail if foreign key constraints are enforced.
Query the referenced table for the set of valid IDs, and check your CSV for any foreign key values that are not in that set.
Running these five checks prevents the majority of import failures. Sohovi automates completeness, type validity, and uniqueness checks on any CSV — upload your file and see the issues before you attempt the import.
4. String Length vs. Column Definition
A VARCHAR(50) column will reject a value of 51 characters. Customers with unusually long names, companies with long legal names, or addresses with suite/unit information appended can exceed your column length limits.
Before importing, check the maximum character length in each string column and compare against your target table's column definitions. Any value exceeding the limit will fail. Either increase the column size in your target table (the cleaner fix) or truncate the values with a warning.
5. Referential Integrity: Foreign Key Validation
If the CSV you're importing references records in another table (order records that reference customer IDs, product records that reference category IDs), verify that every referenced ID actually exists before import.
This is especially important when migrating data between systems, where the ID sequences may differ. A customer ID of "12345" in your old system may not correspond to anything in your new system.
Run a lookup for each foreign key column: any value that doesn't exist in the reference table will cause an integrity violation. Either pre-populate the reference table first or adjust the foreign key values during migration.
Building a Pre-Import Checklist
Turn these five checks into a standard checklist you run for every CSV import:
- Null count for each NOT NULL column — must be 0
- Type check for each strictly-typed column — must be 100% compliant
- Duplicate count on primary key column — must be 0
- Max length for each VARCHAR column — must be within limits
- Foreign key validation for each reference column — must be 100% valid
This checklist takes 15–30 minutes for most files and prevents the majority of import failures. Running it as a habit turns import failures from a debugging exercise into a rare edge case.
Sohovi lets you upload your CSV and get an instant data quality report — no setup, no code required. It catches null rates, format issues, and duplicate values across every column — covering most of this pre-import checklist automatically.
If you're ready to stop guessing about your data quality, Sohovi is built for exactly this. Upload your first CSV free — no credit card, no IT team, no code needed.
Keep Reading
Generate Clean SQL from Your CSV →