Joining 2 SQL Servers -
i trying search 2 servers (a , b). server has database prod_a , server b has prod_b. prod_a has table1 , prob_b has table2. how can merge 2 tables 2 different sql servers? done setting link servers having issues query syntax. thanks.
you need create linked server, using sp_addlinkedserver (documented here). on server issue command:
sp_addlinkedserver serverb
then access remote table using:
select * serverb.prod_b.dbo.table2
this four-part naming convention remote tables. assumes remote table in schema called "dbo". if not, change right schema.
if have permissions problems, post question.
if want access them in 1 query, put tables in 1 query
select * serverb.prod_b.dbo.table2 join prod_a..table1 on . . .
Comments
Post a Comment