How to fix Error 5372 on Windows Server 2025 / Windows 11

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_FORMAT object definition using sp_helpexternalfileformat to confirm whether the source is defined as DELIMITEDTEXT, PARQUET, or ORC.
  • Ensure you are not mixing text-specific options (like CODEPAGE or ROWTERMINATOR) with a PARQUET or ORC format, 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 INSERT query.
  • Remove deprecated flags such as KEEPNULLS or FIRE_TRIGGERS if the target FILE_FORMAT is set to PARQUET.
  • Cross-reference the specific option throwing the error against the sys.external_file_formats catalog 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 BULK command.
  • Right-click the folder, select Properties > Security, and verify the NT SERVICE\MSSQLSERVER account has at least Read & Execute permissions.
  • Restart the SQL Server service via services.msc if permissions were just updated to ensure the token refreshes.

Alternative or Verification Steps

  • Verification: Re-run the original BULK INSERT or OPENROWSET query. If successful, query the destination table using SELECT TOP 10 * FROM [TargetTable] to confirm data integrity and correct column mapping.
  • Alternative: If the error persists specifically with Parquet files, bypass the BULK INSERT T-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.