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

Troubleshooting Guide: Error 4809 – SINGLE_NCLOB Requires a UNICODE Input File

Why This Error Happens

This error occurs when the OPENROWSET(BULK...) function is used with the SINGLE_NCLOB option, but the target file is not encoded in Unicode (UTF-16 with a valid byte-order mark). SQL Server 2025 strictly validates the byte-order mark (BOM) at the start of the file to determine encoding, and SINGLE_NCLOB specifically expects a UTF-16 Little Endian (UTF-16 LE) encoded file. If the file was saved as ANSI, UTF-8, or UTF-8 without a BOM, the engine rejects it immediately with Error 4809.

Step-by-Step Resolution Guide

Step 1: Verify the Current File Encoding

  • Open the file in Visual Studio Code or Notepad++ to check the encoding indicator in the bottom status bar.
  • Look specifically for “UTF-8,” “ANSI,” or “UTF-16 LE” labels.
  • In PowerShell, run Get-Content -Path "C:\Data\yourfile.txt" -Encoding Byte -TotalCount 2 to inspect the first two bytes (should be FF FE for UTF-16 LE).

Step 2: Convert the File to UTF-16 LE Encoding

  • In Notepad++, navigate to Encoding > Convert to UTF-16 LE BOM and save the file.
  • Alternatively, use PowerShell to force the conversion: Get-Content "C:\Data\input.txt" | Set-Content -Encoding Unicode "C:\Data\input_unicode.txt".
  • Ensure the output path does not overwrite source files used by other active processes to avoid file-lock conflicts.

Step 3: Correct the T-SQL Query Logic

  • If the source data is genuinely single-byte (ANSI) or UTF-8, switch the bulk import option from SINGLE_NCLOB to SINGLE_CLOB instead, as this expects standard character data rather than wide characters.
  • Example: SELECT * FROM OPENROWSET(BULK 'C:\Data\input.txt', SINGLE_CLOB) AS Data;
  • Update the query to point to the newly converted Unicode file path if sticking with SINGLE_NCLOB.

Step 4: Validate File Permissions and Path Integrity

  • Confirm the SQL Server Service Account (e.g., NT Service\MSSQLSERVER) has Read permissions on the specific folder in Windows Server 2025.
  • Check that the file path does not contain hidden Unicode characters or incorrect network share mappings that might trigger a secondary file-not-found error alongside the encoding issue.

Alternative or Verification Steps

  • Verification: Re-run the OPENROWSET query after conversion; a successful execution will return the file content as a single row/column without throwing Error 4809.
  • Alternative: If encoding conversion is not feasible on the source system, use SINGLE_BLOB combined with a CAST or CONVERT function within the T-SQL query to handle the binary-to-text conversion manually within SQL Server.