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

Troubleshooting Guide: SQL Server Error 5380 – Unsupported Column Character

Why This Error Happens

Error 5380 occurs when SQL Server encounters a column name containing square brackets ([ or ]) during metadata operations such as replication, Change Data Capture (CDC), or schema synchronization tasks. These characters are reserved as delimiter identifiers in T-SQL syntax, so when they appear literally within a column name, SQL Server’s internal parsing engine cannot distinguish between the delimiter and the actual column name. This typically stems from data migrated from another system, poorly sanitized dynamic SQL scripts, or applications that allow unrestricted naming conventions during table creation.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Column

  • Review the full error message text, which includes the column name in question (replacing %ls with the actual value).
  • Run the following query to scan for bracket characters across your database schema:
SELECT t.name AS TableName, c.name AS ColumnName
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%[[]%' OR c.name LIKE '%]%';
  • Note the exact table and column combination returned.

Step 2: Rename the Column Using Proper Escaping

  • Use sp_rename to safely rename the column, ensuring you wrap the old name in brackets twice to escape it correctly:
EXEC sp_rename 'dbo.YourTable.[Bad]Column]]', 'GoodColumn', 'COLUMN';
  • If the column is referenced in views, stored procedures, or CDC-enabled tables, update those references manually afterward.
  • For CDC or replication scenarios, disable capture on the table first:
EXEC sys.sp_cdc_disable_table @source_schema = 'dbo', @source_name = 'YourTable', @capture_instance = 'all';

Step 3: Re-enable Dependent Features and Validate Scripts

  • If CDC or Replication was disabled in Step 2, re-enable it using sp_cdc_enable_table once the rename is complete.
  • Check any ETL packages (SSIS), linked server queries, or ORM mappings (Entity Framework, Dapper) that reference the old column name and update them accordingly.
  • Re-deploy any affected stored procedures or views using sp_refreshsqlmodule 'YourView' to refresh cached metadata.

Step 4: Restart Associated Services (If Applicable)

  • If the error persists in Windows Server 2025 due to cached execution plans, restart the SQL Server service via services.msc or run:
Restart-Service -Name 'MSSQLSERVER' -Force
  • Clear the procedure cache to ensure no stale references remain:
DBCC FREEPROCCACHE;

Alternative or Verification Steps

  • Verify the fix by re-running the original operation (replication snapshot, CDC capture job, or schema sync) and confirming Error 5380 no longer appears in the SQL Server Error Log (Management > SQL Server Logs in SSMS).
  • As an alternative if renaming is not feasible immediately, wrap all references to the column in properly escaped bracket syntax (e.g., [ColumnName]]]) within affected queries, though this is only a temporary workaround and renaming remains the permanent fix.