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 |
|
piragash
Starting Member
8 Posts |
Posted - 2012-06-07 : 00:37:37
|
| Hi,What is the SQL query command to Join 2 tables ( "TInvDataEntry" and "TANAT_N_ALL") from below different SQL servers"TInvDataEntry" Table located at SQL Server "server='192.9.115.10';uid='da';pwd='da';database='PhyInventoryDB'" and "TANAT_N_ALL" Table located at SQL Server "server='192.9.118.15\Testdb';uid='da';pwd='da';database='MFGDB'" |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-06-07 : 04:24:00
|
| Probably create linked servers and use the 4 part name to join the tables.I wouldn't attempt a join between different servers though - it usually causes poor performance.Try copying the needed data to one server and joining there (that's what the server will try to do but often not as well as you can).==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
kawadeprasad
Starting Member
13 Posts |
Posted - 2012-06-07 : 05:59:57
|
| SELECT .....FROM databaseA.dbo.TableA a inner join database B.dbo.TableB b ON a.userID=b.userIDCan try above one?It should work. |
 |
|
|
vijays3
Constraint Violating Yak Guru
354 Posts |
Posted - 2012-06-07 : 09:23:47
|
quote: Originally posted by kawadeprasad SELECT .....FROM databaseA.dbo.TableA a inner join database B.dbo.TableB b ON a.userID=b.userIDCan try above one?It should work.
User's tables are on different server as suggested by nigelrivett he has to create link server . Your code only will work when tables are on same server. Vijay is here to learn something from you guys. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-07 : 22:40:32
|
| if its for one time adhoc need use OPENROWSET------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|