Using sp_addlinkedserver

The system stored procedure sp_addlinkedserver is used in order to link a server from the server in which you are executing the command. In order to connect to a remote SQL Server, you basically only need 3 parameters.

EXEC sp_addlinkedserver  
   @server=N'HOGEN-PC',             -- Remote Computer Name
   @srvproduct=N'',                 -- Not Needed
   @provider=N'SQLNCLI',            -- SQL Server Driver
   @datasrc=N'HOGEN-PCSQLEXPRESS'-- Server Name And Instance

If the remote SQL Server does not have an instance name, then the @datasrc parameter nee only contain the remote server name and not the instance.

4 comments
Dmitriy 01 Nov 2010 at 12:45 pm

I foud that I whanted ! Thank’s.
Dmitriy Deordiy.

Gio 30 Sep 2010 at 11:47 am

Exactly what I need – simple and straight to the point! Thanks so much!

Featured Articles

 Site Author