Troubleshooting Guide: Error 11545 – Remote Result Set Discovery Failure in SELECT INTO
Why This Error Happens
This error occurs when SQL Server cannot determine the metadata (column names, data types, and sizes) of a result set returned by a remote source, such as a linked server, because the operation is wrapped inside a SELECT INTO statement. SQL Server’s query optimizer requires this metadata upfront to create the destination table schema, but providers like OLE DB or ODBC linked servers often cannot expose this information without actually executing the remote query first, creating a deadlock in the planning phase. This is commonly triggered by distributed queries, OPENQUERY, or four-part naming conventions used directly within a SELECT INTO clause.
Step-by-Step Resolution Guide
Step 1: Rewrite the Query to Avoid Direct SELECT INTO on Remote Sources
- Instead of running
SELECT * INTO LocalTable FROM LinkedServer.DB.Schema.Table, first create the table manually usingCREATE TABLEwith explicit column definitions. - Follow this with a standard
INSERT INTO LocalTable SELECT * FROM LinkedServer...Tablestatement. - This bypasses the need for SQL Server to “discover” the schema automatically during the
INTOoperation.
Step 2: Utilize a Staging Temp Table with OPENQUERY
- If using
OPENQUERY, ensure you are not nesting it directly insideSELECT INTOfor complex joins. - Run the command:
SELECT * INTO #TempStaging FROM OPENQUERY(LinkedServerName, 'SELECT * FROM RemoteTable'). - Verify the linked server provider options have
Nested Queriesenabled via SQL Server Management Studio (SSMS) under Server Objects > Linked Servers > Providers.
Step 3: Verify Linked Server Provider Settings
- Navigate to Linked Servers > [Your Server] > Properties > Server Options in SSMS.
- Ensure
RPCandRPC Outare set to True to allow remote procedure calls necessary for metadata retrieval. - Check that the
Dynamic Parametersoption is enabled under the Provider options if using an OLE DB driver.
Step 4: Update OLE DB Drivers and Check Compatibility
- Confirm that the OLE DB driver (e.g., MSOLEDBSQL) is updated to the latest version compatible with SQL Server 2025 on Windows Server 2025.
- Outdated drivers often lack the “IColumnsInfo” interface support required for remote schema discovery.
- Reinstall the driver via the Microsoft Download Center if the version predates the SQL Server 2025 release cycle.
Alternative or Verification Steps
- Verify the Fix: Run the modified
INSERT INTOscript in a test environment; if the table populates without throwing Error 11545, the schema discovery bypass was successful. - Alternative Method: If the issue persists, use
sp_executesqlto run the remote query as a dynamic string, forcing SQL Server to treat the connection as a standard execution rather than a metadata discovery request.