Troubleshooting Guide: Error 5372 in SQL Server 2025
Why This Error Happens
Error 5372 occurs when a BULK INSERT or OPENROWSET(BULK...) statement specifies an option (such as FORMATFILE, ROWTERMINATOR, or FIELDQUOTE) that is incompatible with the declared FILE_FORMAT or data source type (e.g., attempting CSV-specific syntax against a Parquet file). This typically arises from a mismatch between legacy flat-file bulk options and the newer structured file formats introduced for Data Lake integration in SQL Server 2025. It can also occur if a format file (.fmt or .xml) was generated for a different file type than the one currently being referenced in the BULK command.
Step-by-Step Resolution Guide
Step 1: Verify the File Format Compatibility
- Check the
FILE_FORMATobject definition usingsp_helpexternalfileformatto confirm whether the source is defined asDELIMITEDTEXT,PARQUET, orORC. - Ensure you are not mixing text-specific options (like
CODEPAGEorROWTERMINATOR) with aPARQUETorORCformat, as these binary formats manage schema internally and do not support manual delimiter overrides.
Step 2: Audit the T-SQL Syntax for Deprecated Options
- Open SQL Server Management Studio (SSMS) 21 or Azure Data Studio and review the exact
BULK INSERTquery. - Remove deprecated flags such as
KEEPNULLSorFIRE_TRIGGERSif the targetFILE_FORMATis set toPARQUET. - Cross-reference the specific option throwing the error against the
sys.external_file_formatscatalog view to ensure it exists for that format type.
Step 3: Recreate the External File Format Object
- Drop the existing file format object to clear potential metadata corruption:
DROP EXTERNAL FILE FORMAT [YourFormatName];
- Recreate it with explicit, format-appropriate syntax. For a Parquet-based import, ensure you are not passing a
FORMAT_TYPE = 'CSV'option:
CREATE EXTERNAL FILE FORMAT [YourFormatName]
WITH (FORMAT_TYPE = PARQUET);
Step 4: Check Windows Server 2025 File Path Permissions
- Navigate to the physical storage location (local path or mapped network share) referenced in the
BULKcommand. - Right-click the folder, select Properties > Security, and verify the
NT SERVICE\MSSQLSERVERaccount has at least Read & Execute permissions. - Restart the SQL Server service via
services.mscif permissions were just updated to ensure the token refreshes.
Alternative or Verification Steps
- Verification: Re-run the original
BULK INSERTorOPENROWSETquery. If successful, query the destination table usingSELECT TOP 10 * FROM [TargetTable]to confirm data integrity and correct column mapping. - Alternative: If the error persists specifically with Parquet files, bypass the
BULK INSERTT-SQL command entirely and use the SQL Server Import and Export Wizard (available via SSMS 21) to graphically map the Parquet schema to the destination table.