Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    6

    Unanswered: How do I specify Catalogue while querying a linked server?

    How do I specify the Catalogue while querying a linked server?

    For exmaple, I have a remote SQL 2000 server as a linked server on my server. I will refer to it as "ServerRemote." I was given access to that server through my Active Directory Domain account and the catalogue 'master' was set as my default database.

    Aside from having the admin change my default database, is there a way to query a linked server and specify the catalogue in the query?

    Right now I use the following code to query the default catalogue for the linked server:
    Code:
    SELECT * FROM ServerRemote...ViewName
    I've tried various queryies for a different catalogue but always get a table not found error:

    Code:
    SELECT * FROM ServerRemote..DatabaseName.ViewName
    or
    SELECT * FROM ServerRemote.DatabaseName..ViewName
    or
    SELECT * FROM ServerRemote.DatabaseName.ViewName
    all return errors

  2. #2
    Join Date
    Nov 2005
    Posts
    6

    Nevermind... figured it out

    Of course... as soon as I post this I find a way that works.

    Apparently you have to add the owner as well. So the proper syntax would be:

    Code:
    SELECT * FROM ServerRemote.DatabaseName.Owner.ViewName

Posting Permissions

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