John Glisson's Blog

Geeky stuff…

SQL Server Loopback Linked Server

leave a comment »

Occasionally I run across companies that make use of linked servers. This can be a nasty little detail in a development environment to fully test database code. The solution is to create a loopback linked server so that code referencing a linked server will run as if it were running in the distributed production environment.

  1. Get a backup of the database on the other end of the linked server call.
  2. Restore the backup on your local SQL Server instance
  3. Run the code below to create the loopback linked server

EXEC sp_addlinkedserver @server = N’name_for_linked_server’,

@srvproduct = N’ ‘,

@provider = N’SQLNCLI’,

@datasrc = N’name_of_my_sqlserver_instance’,

@catalog = N’name_of_database’

 

 

Advertisement

Written by jglisson73

February 24, 2011 at 6:31 pm

Posted in Uncategorized

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.