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.

[cc lang=”sql”]
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
[/cc]

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.

3 comments
Saad Masood 13 Sep 2017 at 10:32 pm

Don’t be a traitor to Penn Hasan.

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

  • Thanks for visiting!
css.php