While executing Select query to pull data from a different server, SQL Server is showing following error:

Msg 7202, Level 11, State 2, Line 1
Could not find server 'LAPTOP-09O6NE3K\SQLEXPRESS03' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

Completion time: 2024-02-05T17:18:24.6869756+05:30

Solution:

Step1: 
Check if the server is available in the sys.servers table
SELECT name from sys.servers

Step2: 
If no, add the new server to the sys.servers table
EXEC sp_addlinkedserver @server = 'server name'
Eg"
EXEC sp_addlinkedserver @server = 'LAPTOP-09O6NE3K\SQLEXPRESS03'

Step3: 
Recheck if the new server name is added to the sys.servers table.
If yes, try then rerunning the select query which throwed the error. Now it should pull data from the table in the new server successfully.
 
 


Comments

Popular posts from this blog

SQL Server script Error: Insufficient result space to convert uniqueidentifier value to char.

Overcoming Performance Issues with Memory Optimized tables - SQL Server 2014 CPT2