March 25, 2009 at 12:58 am
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
March 25, 2009 at 3:01 am
Take the output from open query in a temp table..and join this to another ...
March 25, 2009 at 3:40 am
ibrahim_sh_87 (3/25/2009)
hey alli 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.
March 25, 2009 at 6:08 am
Hi
This works:
SELECT *
FROM OPENQUERY(LinkedServerName, 'EXECUTE RemoteDatabase.dbo.usp_test')
Greets
Flo
March 25, 2009 at 6:10 am
Hi
This works:
SELECT *
FROM OPENQUERY(LinkedServerName, 'EXECUTE RemoteDatabase.dbo.usp_test')
Greets
Flo
March 25, 2009 at 6:13 am
Hi
This works:
SELECT *
FROM OPENQUERY(LinkedServerName, 'EXECUTE RemoteDatabase.dbo.usp_test')
Greets
Flo
March 25, 2009 at 7:46 am
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