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

Troubleshooting Guide: Error 5379 in Microsoft SQL Server 2025

Why This Error Happens

Error 5379 occurs when a column definition in a CREATE EXTERNAL TABLE or bulk operation statement explicitly specifies a column ordinal value for a file format that does not support ordinal-based column mapping (such as JSON or Parquet). This typically happens when scripts generated for one file format (like CSV with DATA_SOURCE ordinal positioning) are reused or copy-pasted for an incompatible format without removing the COLUMN_ORDINAL property. It can also arise due to corrupted or outdated external table metadata that retains legacy ordinal attributes after a file format migration.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Column Definition

  • Open the T-SQL script that generated the external table or bulk insert operation.
  • Locate the specific column named in the error message (%ls).
  • Check if a COLUMN_ORDINAL = n property is explicitly declared within the WITH clause for that column.

Step 2: Remove or Correct the Ordinal Property

  • If the file format is Parquet, ORC, or JSON, delete the COLUMN_ORDINAL attribute entirely, as these formats use schema-on-read column name matching rather than positional indexing.
  • If the file format is Delimited Text (CSV), verify that COLUMN_ORDINAL values are sequential integers starting from 1 with no gaps or duplicates.
  • Save the corrected script to a local path, e.g., C:\Scripts\Fix_ExternalTable.sql.

Step 3: Drop and Recreate the External Table

  • Execute DROP EXTERNAL TABLE [SchemaName].[TableName]; to clear the corrupted metadata.
  • Re-run the corrected CREATE EXTERNAL TABLE statement from your fixed script.
  • Confirm the associated External File Format object matches the data source type using sp_helpexternalfileformat.

Step 4: Restart SQL Server Services (If Cached Metadata Persists)

  • Open Services.msc on Windows Server 2025 / Windows 11.
  • Locate SQL Server (MSSQLSERVER) or the named instance.
  • Right-click and select Restart to clear any cached schema definitions in the Polybase/External Data engine.

Alternative or Verification Steps

  • Run SELECT * FROM sys.external_columns WHERE object_id = OBJECT_ID('TableName'); to verify no residual ordinal values remain in the system metadata.
  • If the error persists, bypass the issue entirely by querying the data source using OPENROWSET with explicit WITH schema declarations instead of a persistent CREATE EXTERNAL TABLE object.