Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Syntax for query to another SQL-Server-Instance

 
   Database Forums (Home) -> MSEQ RSS
Next:  Shared agent - how do I know which it is? How do ..  
Author Message
Florian L.

External


Since: Aug 19, 2007
Posts: 4



(Msg. 1) Posted: Wed Aug 22, 2007 2:38 pm
Post subject: Syntax for query to another SQL-Server-Instance
Archived from groups: microsoft>public>sqlserver>mseq (more info?)

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
F. L.

 >> Stay informed about: Syntax for query to another SQL-Server-Instance 
Back to top
Login to vote
Florian L.

External


Since: Aug 19, 2007
Posts: 4



(Msg. 2) Posted: Wed Aug 22, 2007 2:42 pm
Post subject: RE: Syntax for query to another SQL-Server-Instance [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I have to mention that the SQL-Instance is on another Server (linked server).

 >> Stay informed about: Syntax for query to another SQL-Server-Instance 
Back to top
Login to vote
Russell Fields

External


Since: Feb 21, 2007
Posts: 457



(Msg. 3) Posted: Thu Aug 23, 2007 10:46 am
Post subject: Re: Syntax for query to another SQL-Server-Instance [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

"Florian L." wrote in message

>I have to mention that the SQL-Instance is on another Server (linked
>server).
 >> Stay informed about: Syntax for query to another SQL-Server-Instance 
Back to top
Login to vote
Florian L.

External


Since: Aug 19, 2007
Posts: 4



(Msg. 4) Posted: Thu Aug 23, 2007 3:16 pm
Post subject: Re: Syntax for query to another SQL-Server-Instance [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for the info!

Regards
Florian


"Russell Fields" wrote:

> 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
>
> "Florian L." wrote in message
>
> >I have to mention that the SQL-Instance is on another Server (linked
> >server).
>
>
>
 >> Stay informed about: Syntax for query to another SQL-Server-Instance 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Query syntax help - I am trying to write a query that returns all suppliers within a given range that either do not have any insurance (appear only in Suppliers table) or Suppliers where the insurance has expired from a given date Eg 4 Suppliers Supplier1 - no insurance....

Join syntax? - I'm not sure if this is a join problem or even if it can be done. The english part of the query will be requesting cagegoires="Cat2" and return the matching records in table1, plus return all the other categories that belong to the set in ta...

Get user syntax - I am building a view for a report and one of the requirements is to grab the user who is running the report. What would this syntax look like? I thought it was getuser(), but no luck there. Thanks, Ryan

SQL Syntax Question - I have the following syntax: "select itemnmbr, locncode, (qtyonhnd-atyalloc) as "QTY Available Main" from iv00102 " The results look like; Itemnmbr locncode qty available main 121 944-16 ...

English Query still available in SQL Server 2005? - English Query still available in SQLServer 2005, or something that implements natural query? -- Miguel Brito Santos
   Database Forums (Home) -> MSEQ All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]