Remote SQL Server access from SP

  • Is it possible to make a connection to a database on a remote SQL Server from a stored procedure on your local SQL server?

  • Yes. You can do so through the use of linked server or the use of certain remote query recordset commands (OPENQUERY, OPENROWSET).

    K. Brian Kelley
    @kbriankelley

  • You could do a lot more with linked server, especially when the remote server is SQL Server too. Queries, store procedures and transactions etc.

  • If you are going to repeatedly use the remote server through stored procedures and queries, it is better to set up that server as a linked server.  Creating a linked server gives you many more options and ensures a greater range of SQL statements and functions.  The options you can configure include security options, timeout limits on connections and queries, as well as data access parameters.  To add a linked server, you can add or modify it through Enterprise Manager in the Security section or use the system stored procedure sp_addlinkedserver.  For more information on linked servers, see SQL Server Books Online (BOL).

    If you only need to query information rarely, it may be better to use OPENQUERY or OPENROWSET.

Viewing 4 posts - 1 through 3 (of 3 total)

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