How can you link more than 1 database?

  • Is there a way to link to more than one database through linked servers?

    Rob DeMotsis

    Sr. SQL Server DBA

    Pier 1 Imports, Inc.


    Rob DeMotsis
    Sr. SQL Server DBA

  • I suppose you could, but why not have 2 linked servers?

    Steve Jones

    steve@dkranch.net

  • Your right. I could just create a linked server using the other data source option and name it the database I want to link to.

    Rob DeMotsis

    Sr. SQL Server DBA

    Pier 1 Imports, Inc.


    Rob DeMotsis
    Sr. SQL Server DBA

  • When I have worked with Linked Servers, I found creating a linked server against a database and linking it to a specific login (such as one that had limited access for read only or execute on some stored procedures) made it much easier to implement another linked server for another requested use against other tables/procedures. Just a different twist on using them.

    Jody

  • That is exactly what we do here as well. It works out when trying to keep everything organized.

    Rob DeMotsis

    Sr. SQL Server DBA

    Pier 1 Imports, Inc.


    Rob DeMotsis
    Sr. SQL Server DBA

  • If you link to another SQL Server, use the proper four part naming convention (including owner) to hit multiple databases on the same server... provided the login account being used has permissions. For instance:

    SELECT *

    FROM MyServer.Northwind.dbo.Customers

    SELECT *

    FROM MyServer.pubs.dbo.Authors

    will work for a single linked server MyServer.

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

Viewing 6 posts - 1 through 5 (of 5 total)

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