开发者

sql query for join two tables of different databases that are in two Servers

i have two tables tableA in databaseA on ServerA and tableB in databaseB on ServerB. i just want to perform fullouter join to th开发者_开发知识库ese tables based on common fieldname of it


In SQL Server, you can create a linked server (in Management Studio, that's under Server Objects.) Then you can use a four part name to join the tables:

select  *
from    localdb.dbo.localtable as t1
full outer join
        linkedserver.remotedb.dbo.remotetable as t2
on      t1.col1 = t2.col1

If you're using another database, please edit your question to say which.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜