Saturday, 6 June 2015

How to link 2 SQL DB servers

If someone wants to get data from 2 tables from 2 different SQL DB server. Then execute below stored procedures before running your query.

Step1: exec sp_addlinkedserver    @server=db-server-name

Step2: EXEC sp_addlinkedsrvlogin db-server-name, false, NULL, id, password

Once you executed above SPs successfully, you can check linked server list by executing below SP.

exec sp_linkedservers

No comments:

Post a Comment

Dear Readers, Please post your valuable feedback in the comment section if you like this blog or if you have any suggestions. I would love to hear the same from you. Thanks