Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005

    Unanswered: Query across servers

    I'm new to SQL and I'm trying to write a stored procdeure in my current database that queries a different database on a different server. What is the best way to do this?

    Thanks and sorry if it's too remedial a question.

  2. #2
    Join Date
    Nov 2004
    on the wrong server
    Provided Answers: 6
    you will need to set up a linked server. there is a great product documentation tool called Books Online under Start\Programs\Micorsoft SQL Server. Use the search feature for "linked server". You can then reference your the linked server using openquery or you can create a view that created with openquery. again see books online about openquery and views.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Mar 2003
    You can use OpenDataSource. Check that from BOL.

    SELECT *
    'Data Source=ServerName;User ID=MyUID;Password=MyPass'

Posting Permissions

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