Query across different servers

  • Hi,

    I suspect this is an often asked question, but searching does not return any results (perhaps I have the terminology incorrect)

    I wish to use T-sql to query a database on one server, from a database on another.

    What, if anything, do I have to do to set up a connection between the two severs?

    What Syntax do I use in the query?

    is it <servername>.<dbname>.<owner>.tablename?

  • Easiest is probably to create a linked server - see security in enterprise manager or sp_addlinkedserever in bol. Then you can query it using the 4 part name as you say.

    You can also access it via openrowset without creating a linked server and openquery.

    Cursors never.

    DTS - only when needed and never to control.


    Cursors never.
    DTS - only when needed and never to control.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply