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

Why This Error Happens

Error 5343 occurs when a BULK INSERT or OPENROWSET statement specifies ROWTERMINATOR and FIELDTERMINATOR/DELIMITER arguments without providing either a WITH clause that defines column schema or enabling schema inference for the flat file. SQL Server 2025’s updated bulk-load parser requires explicit structural context to interpret delimiters correctly, since the engine no longer assumes a default schema for ambiguous file formats. This typically happens after migrating scripts from older SQL Server versions where delimiter-only syntax was still permitted without a formal schema definition.

Step-by-Step Resolution Guide

Step 1: Review the Current Bulk Import Statement

  • Open the T-SQL script or stored procedure that triggered Error 5343.
  • Check whether the OPENROWSET(BULK...) or BULK INSERT command includes a WITH (...) clause.
  • Confirm if FIELDTERMINATOR, ROWTERMINATOR, or DELIMITER are declared without accompanying column definitions.

Step 2: Add an Explicit WITH Clause or Format File

  • Modify the statement to include a WITH clause specifying column names, data types, and ordinal positions, for example:
    WITH (col1 INT, col2 VARCHAR(50))
  • Alternatively, generate a .fmt format file using bcp with the -f switch and reference it via FORMATFILE = 'C:\SQLData\import.fmt'.
  • Ensure the format file path is accessible to the SQL Server service account on Windows Server 2025.

Step 3: Enable Schema Inference for Flat Files

  • If using OPENROWSET with FORMAT = 'CSV', add PARSER_VERSION = '2.0' and set HEADER_ROW = TRUE to allow automatic schema inference.
  • Confirm the file encoding (UTF-8) and header row are properly formatted, since inference depends on consistent column headers.
  • Re-run the query after saving changes to validate that the terminators are now recognized within a defined schema context.

Step 4: Restart SQL Server Service and Clear Plan Cache

  • Open SQL Server Configuration Manager on Windows Server 2025 and restart the SQL Server (MSSQLSERVER) service.
  • Run DBCC FREEPROCCACHE; to remove any cached execution plans referencing the old syntax.
  • Re-execute the corrected bulk import script.

Alternative or Verification Steps

  • Run the corrected script in SQL Server Management Studio (SSMS) and confirm the import completes without Error 5343, then validate row counts in the target table.
  • If the error persists, test the import using a minimal sample CSV file with a manually defined WITH clause to isolate whether the issue is file-specific or schema-specific.