How to write a SELECT statement to get data from a linked server - I need the SQL syntax please

  • Hello

    Please see attached. I have the linked server connection created and works perfectly well. I mean I am able to see the tables while I am on my database.

    So my next question is how do I write a SQL statement to reference the linked server ?

    See the pic please.

    I tried the following:

    Select top 100 * from casmpogdbspr1.MPOG_Collations.dbo.AsaClass_Cleaned

    Then I get the error message....

    Msg 7314, Level 16, State 1, Line 1

    The OLE DB provider "SQLNCLI10" for linked server "casmpogdbspr1" does not contain the table ""MPOG_Collations"."dbo"."AsaClass_Cleaned"". The table either does not exist or the current user does not have permissions on that table.

  • You have the schema wrong.

    Select top 100 *

    from casmpogdbspr1.MPOG_Collations.Collation.AsaClass_Cleaned

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Thanks...

    That was my mistake..

    Works well......

    CASE CLOSED!

    Credit for LUIS ( Well done! )

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

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