all groups > sql server mseq > august 2007 >
You're in the

sql server mseq

group:

Syntax for query to another SQL-Server-Instance


Syntax for query to another SQL-Server-Instance Florian L.
8/22/2007 2:38:03 PM
sql server mseq:
Hi,

what is the correct syntax to execute a query to a table on another
SQL-Server-Instance.

For example:
dbo.table on Server1 with Instance2 (Server1\Instance2)


Thanks in advance
RE: Syntax for query to another SQL-Server-Instance Florian L.
8/22/2007 2:42:02 PM
Re: Syntax for query to another SQL-Server-Instance Russell Fields
8/23/2007 10:46:21 AM
Florian,

You need to include the LinkedServer name, shown as SQLSERVER1 below:

SELECT FirstName, LastName, EmailAddress
FROM SQLSERVER1.AdventureWorks.Person.Contact
WHERE EmailPromotion = 5

To execute a stored procedure on a remote server, the BOL has this example:

DECLARE @retstat int;
EXECUTE @retstat = SQLSERVER1.AdventureWorks.dbo.uspGetEmployeeManagers
@EmployeeID = 6;


RLF

[quoted text, click to view]

Re: Syntax for query to another SQL-Server-Instance Florian L.
8/23/2007 3:16:00 PM
Thanks for the info!

Regards
Florian


[quoted text, click to view]
AddThis Social Bookmark Button