Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    16

    Unanswered: Créate connection in T-SQL

    Helo everybody

    How to créate differente connection in the same script and apply this in a query. I use Query analyser. I can do that?

    If you ave something about that ... internet link...

    Exemple like that (is not working...!)
    ========================
    Server NameerverName1
    User:user_srv1
    Passass_srv1
    Server NameerverName2
    User:user_srv2
    Passass_srv2

    SELECT a.FieldID, b.FieldID FROM
    ServerName1.DatabaseName.dbo.TableName a,
    ServerName2.DatabaseName.dbo.TableName b
    WHERE a.FieldID=b.FieldID
    =========================

    THANKS

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149
    You should be creating linked server to access the database on a remote server. You could create the linked server and the login on the fly and drop them after you are done with your code. check out BOL for creating the linked server.

    -cbarus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •