Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
miri
Starting Member
9 Posts |
Posted - 2007-12-19 : 02:10:33
|
| Hi Everyone,I try to write a sql statement ,who checks data between 2 servers .one is sql2000 and the other is mssql2005.How do I write the join command ?Thanks!miri |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-19 : 02:54:48
|
| Do any one of these servers is added as a linked server on the other?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-19 : 03:10:14
|
| or read about OPENDATASOURCE in sql server help fileMadhivananFailing to plan is Planning to fail |
 |
|
|
miri
Starting Member
9 Posts |
Posted - 2007-12-19 : 03:28:23
|
| yes,the servers are linked .Thank you.miri |
 |
|
|
Hariarul
Posting Yak Master
160 Posts |
Posted - 2007-12-19 : 03:49:56
|
| Try the below syntax..SELECT A.Col1, B.Col1 FROM [SRVR1].[DB].[USR].[TABLE1] A , [SRVR2].[DB].[USR].[TABLE1] BWHERE <Condition> |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-19 : 04:07:00
|
quote: Originally posted by Hariarul Try the below syntax..SELECT A.Col1, B.Col1 FROM [SRVR1].[DB].[USR].[TABLE1] A , [SRVR2].[DB].[USR].[TABLE1] BWHERE <Condition>
Never use Non-ANSI Join syntax.Use ANSI syntax as below:SELECT A.Col1, B.Col1 FROM [SRVR1].[DB].[USR].[TABLE1] A JOIN [SRVR2].[DB].[USR].[TABLE1] BON A.COL1 = B.COL1WHERE <Condition> Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2007-12-19 : 15:28:03
|
| ...just be aware that there are some performance issues in doing joins across linked servers. The DTC (distributed transactions coordinator) has to start up and this can cause some delays. You should also be aware that your query will be volnurable to all sorts of connectivity/network problems also...--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
|
|
|