Wednesday, March 28, 2012

How to create multiple connection in T_SQL script

How to create multiple connection in the same T-SQL script and apply this in a query.

*I can do that?

Exemple like that (is not working...!)
========================
Server Name:ServerName1
User:user_srv1
Password : PW_srv2
Server Name:ServerName2
User:user_srv2
Password : PW_srv2

SELECT a.FieldID, b.FieldID FROM
ServerName1.DatabaseName.dbo.TableName a,
ServerName2.DatabaseName.dbo.TableName b
WHERE a.FieldID=b.FieldIDCreate server1 and server2 as link servers, then you can execute the query.

No comments:

Post a Comment