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

Query across servers with SQL 2000

 
   Database Help (Home) -> Programming RSS
Next:  Script table with indexes.  
Author Message
bringmewater

External


Since: Jan 23, 2008
Posts: 14



(Msg. 1) Posted: Wed Feb 07, 2007 5:59 am
Post subject: Query across servers with SQL 2000
Archived from groups: microsoft>public>sqlserver>programming (more info?)

Hi, I'm trying to query across two different servers but get a syntax
error at '-'. Thanks for any help.

Line 2: Incorrect syntax near '-'.

SELECT shipname, lastname, firstname
FROM mysrv-s-d..Northwind.dbo.Orders d
JOIN mysrv2-s-p..Northwind.dbo.Employees p ON d.employeeid =
p.employeeid

 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
bringmewater

External


Since: Jan 23, 2008
Posts: 14



(Msg. 2) Posted: Wed Feb 07, 2007 8:36 am
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I'm getting closer but ......

SELECT shipname
FROM [csd-s-sde-91-d]..Northwind.dbo.Orders d


Server: Msg 117, Level 15, State 1, Line 2
The object name 'csd-s-sde-91-d..Northwind.dbo.' contains more than
the maximum number of prefixes. The maximum is 3.


Thanks for any ideas

 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
bringmewater

External


Since: Jan 23, 2008
Posts: 14



(Msg. 3) Posted: Wed Feb 07, 2007 8:43 am
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Also, If I replace the ".." with "." I get:


SELECT shipname, lastname, firstname
FROM [csd-s-sde-91-d].Northwind.dbo.Orders d
JOIN [csd-s-sde-91-p].Northwind.dbo.Employees p ON d.employeeid =
p.employeeid

Server: Msg 7202, Level 11, State 2, Line 1
Could not find server 'csd-s-sde-91-p' in sysservers. Execute
sp_addlinkedserver to add the server to sysservers.


What is the correct syntax please?
 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
Raymond D'Anjou

External


Since: Feb 04, 2008
Posts: 17



(Msg. 4) Posted: Wed Feb 07, 2007 8:59 am
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

SELECT shipname, lastname, firstname
FROM [mysrv-s-d]..Northwind.dbo.Orders d
JOIN [mysrv2-s-p]..Northwind.dbo.Employees p ON d.employeeid =
p.employeeid

wrote in message

> Hi, I'm trying to query across two different servers but get a syntax
> error at '-'. Thanks for any help.
>
> Line 2: Incorrect syntax near '-'.
>
> SELECT shipname, lastname, firstname
> FROM mysrv-s-d..Northwind.dbo.Orders d
> JOIN mysrv2-s-p..Northwind.dbo.Employees p ON d.employeeid =
> p.employeeid
>
 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
bringmewater

External


Since: Jan 23, 2008
Posts: 14



(Msg. 5) Posted: Wed Feb 07, 2007 9:02 am
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Isn't this possible with fully qualified domain names and not having
to use linked servers?

Thanks again.
 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
Uri Dimant

External


Since: Aug 24, 2003
Posts: 1744



(Msg. 6) Posted: Wed Feb 07, 2007 4:15 pm
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Try
SELECT shipname, lastname, firstname
FROM [mysrv-s-d].Northwind.dbo.Orders d
JOIN [mysrv2-s-p].Northwind.dbo.Employees p ON d.employeeid =
p.employeeid

wrote in message

> Hi, I'm trying to query across two different servers but get a syntax
> error at '-'. Thanks for any help.
>
> Line 2: Incorrect syntax near '-'.
>
> SELECT shipname, lastname, firstname
> FROM mysrv-s-d..Northwind.dbo.Orders d
> JOIN mysrv2-s-p..Northwind.dbo.Employees p ON d.employeeid =
> p.employeeid
>
 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
Immy

External


Since: Aug 31, 2006
Posts: 60



(Msg. 7) Posted: Wed Feb 07, 2007 4:15 pm
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

and TRY not to use '-' in servernames!
"Uri Dimant" wrote in message

> Try
> SELECT shipname, lastname, firstname
> FROM [mysrv-s-d].Northwind.dbo.Orders d
> JOIN [mysrv2-s-p].Northwind.dbo.Employees p ON d.employeeid =
> p.employeeid
>
> wrote in message
>
>> Hi, I'm trying to query across two different servers but get a syntax
>> error at '-'. Thanks for any help.
>>
>> Line 2: Incorrect syntax near '-'.
>>
>> SELECT shipname, lastname, firstname
>> FROM mysrv-s-d..Northwind.dbo.Orders d
>> JOIN mysrv2-s-p..Northwind.dbo.Employees p ON d.employeeid =
>> p.employeeid
>>
>
>
 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
Raymond D'Anjou

External


Since: Feb 04, 2008
Posts: 17



(Msg. 8) Posted: Wed Feb 07, 2007 4:15 pm
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

....or any other 'weird' characters including 'spaces'.

"Immy" wrote in message

> and TRY not to use '-' in servernames!
> "Uri Dimant" wrote in message
>
>> Try
>> SELECT shipname, lastname, firstname
>> FROM [mysrv-s-d].Northwind.dbo.Orders d
>> JOIN [mysrv2-s-p].Northwind.dbo.Employees p ON d.employeeid =
>> p.employeeid
>>
>> wrote in message
>>
>>> Hi, I'm trying to query across two different servers but get a syntax
>>> error at '-'. Thanks for any help.
>>>
>>> Line 2: Incorrect syntax near '-'.
>>>
>>> SELECT shipname, lastname, firstname
>>> FROM mysrv-s-d..Northwind.dbo.Orders d
>>> JOIN mysrv2-s-p..Northwind.dbo.Employees p ON d.employeeid =
>>> p.employeeid
>>>
>>
>>
>
>
 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
Tibor Karaszi

External


Since: Jan 29, 2004
Posts: 1559



(Msg. 9) Posted: Wed Feb 07, 2007 7:21 pm
Post subject: Re: Query across servers with SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

If you want to reach out of the server (instance) that you have connected to, you have to use add
the server as a linked server (sp_addlinkedserver), or using OPENROWSET().

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


wrote in message

> Isn't this possible with fully qualified domain names and not having
> to use linked servers?
>
> Thanks again.
>
 >> Stay informed about: Query across servers with SQL 2000 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
SQL Query over two servers?.. - Hi all, I have this problem : I have two Servers with SQL Server 2005 : one dev and one prod. I'd like to do the following : Update my table 'Titles' on prod so that it insert any row not found on prod but that appears on dev. Something like : INSERT..

query performace between 2 identical servers - SQL 2005 x64 I have 2 identical 64 bit servers; 1 is dev, 1 is qa. Everything on the boxes are identical; they are both 64 bit boxes, running the same version of SQL, with identical san attached drives and nearly an identical amount of free space..

Help with a Query to be run accross 2 SQL Servers. - I hope someone can help me with this . We have 2 SQL Servers. ACCTG and OPS. Database on ACCTG SQL Server is Solapp and on OPS SQL server is Opsapp. I needed to run a query to see what values in Table -SOSHIPHeader Coloumn- User7 did not exist on..

Crosstab query in sql server 2000 - Hi!, I'm trying to make a cross tab query in sql server, I know how to do it, but I need to improve the performance of my query, I'm working with vb.net 2005 and sql server 2000 I need to visualize the information of a different way: My Query: ..

different servers - Hello, Can I insert by selecting from a similar database on a different server? I'm getting error : Login failed for user 'sa'. ...when I try the following.. CREATE PROCEDURE theuser.usp_updatepages AS INSERT INTO server2.db.theuser.pages SELECT ...
   Database Help (Home) -> Programming 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 ]