Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query Remote Server

Author  Topic 

petek
Posting Yak Master

192 Posts

Posted - 2008-11-18 : 09:16:18
Hi all,

Does anybody know how query a remote server....

I haev two linked servers i need to know how to query the machines at each end.



Kind Regards

Pete.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-18 : 09:17:55
use OPENQUERY or just use four part names as server.db.schema.object
Go to Top of Page

petek
Posting Yak Master

192 Posts

Posted - 2008-11-18 : 09:18:31
do you have an example please...

Kind Regards

Pete.
Go to Top of Page

petek
Posting Yak Master

192 Posts

Posted - 2008-11-18 : 09:20:13
I got it i think


Select * from SQL.Test.dbo.table_1


Kind Regards

Pete.
Go to Top of Page

petek
Posting Yak Master

192 Posts

Posted - 2008-11-18 : 09:20:37
is it possibleit use this to exec a stored procedure??

Kind Regards

Pete.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-18 : 09:21:22
http://doc.ddart.net/mssql/sql70/sp_adda_17.htm
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-18 : 09:22:06
quote:
Originally posted by petek

is it possibleit use this to exec a stored procedure??

Kind Regards

Pete.


yup. its possible. just use server.db.schema.procedurename
Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-11-18 : 09:22:07
I think Exec SQL.Test.dbo.YourStoredProc
Go to Top of Page

petek
Posting Yak Master

192 Posts

Posted - 2008-11-18 : 09:24:37
you guys are the best, thanks again....

Kind Regards

Pete.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-18 : 09:25:55
Cheers
Go to Top of Page
   

- Advertisement -