ibrahim

  • hey all

    i am trying to query from a stored Procedure found from a remote server...and join the results with data found on a table another database.... my sql statment looked like that:

    select col1,col2,..,local.colx from openquery(LSname,'exec storedproc') where openquery(LSname,'exec storedproc').colx=local.colx

    i know it is wrong..please hel

  • Take the output from open query in a temp table..and join this to another ...

  • ibrahim_sh_87 (3/25/2009)


    hey all

    i am trying to query from a stored Procedure found from a remote server...and join the results with data found on a table another database.... my sql statment looked like that:

    select col1,col2,..,local.colx from openquery(LSname,'exec storedproc') where openquery(LSname,'exec storedproc').colx=local.colx

    i know it is wrong..please hel

    use OPENQUERY to get the result, for more information see SQL BOL.

  • Hi

    This works:

    SELECT *

    FROM OPENQUERY(LinkedServerName, 'EXECUTE RemoteDatabase.dbo.usp_test')

    Greets

    Flo

  • Hi

    This works:

    SELECT *

    FROM OPENQUERY(LinkedServerName, 'EXECUTE RemoteDatabase.dbo.usp_test')

    Greets

    Flo

  • Hi

    This works:

    SELECT *

    FROM OPENQUERY(LinkedServerName, 'EXECUTE RemoteDatabase.dbo.usp_test')

    Greets

    Flo

  • Not sure what the 'local' is supposed to be or where col1,col2 are but is this what you are trying to do ?

    SELECT col1,col2,l.colx

    FROM [localtable] l

    INNER JOIN OPENQUERY(LSname,'exec storedproc') r ON r.colx=l.colx

    Far away is close at hand in the images of elsewhere.
    Anon.

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

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