Friday, February 10, 2012

Can I link 2 tables from 2 different SQL Servers ?

I know that 2 tables from 2 databases can be join together. But how about 2 tables from 2 databases which are store separately on 2 different SQL servers . Can this be done ?You can create a linked server and join the tables using the 4 part sytax

select *
from svr1.db1.owner1.tbl1 tbl1
join svr2.db2.owner2.tbl2 tbl2
on tbl1.fld1 = tbl2.fld2

Be careful though as the data will have to be sent to one of the servers to do the join.
Setting collation compatability for the linked server will also affect this.|||Will this effect the performance of the servers ?

Will joining 2 SQL servers improve the performance of a query that was previously having performance problems ?|||>> Be careful though as the data will have to be sent to one of the servers to do the join.

It will probably be very slow.

No comments:

Post a Comment