Link MS SQL Database Server

MS SQL Server A Name: A

MS SQL Server B Name: B

I want to connect server B to A so that when I am in server A, I can access database and tables from server B

 

Using SQL Management studio, connect to A and run the following command:

 

EXEC master.dbo.sp_addlinkedserver @server = N’B‘, @srvproduct=N’B‘, @provider=N’SQLOLEDB’,

@datasrc=N’B‘, @provstr=N’Provider=SQLOLEDB;Server=B;UID=xx;PWD=xx‘,

@catalog=N’Database_Name_of_B

 

SELECT * FROM B.Database_Name_of_B.DBO.SALES_ORDERS

Advertisements

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 )

Google+ photo

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

Connecting to %s