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

Leave a Comment

RSS
YouTube
YouTube
Instagram