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 2000 Forums
 Transact-SQL (2000)
 Pls Help - Urgent handling "-" in query

Author  Topic 

vbseeker
Starting Member

8 Posts

Posted - 2004-06-25 : 06:14:55
Hi,

i am using sp_addlinkedserver to connect with my another server.
Let say my current server name is anand and other server name is anand-new

now sp_addlinkedserver worked ok

Now i want to fetch some record from the anand-new server.

I am writing my query in I server (i.e. Anand)


SELECT TOP 10 * FROM anand-new.NEWSITE.DBO.Xyz_NEW

I am getting error

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '-'.


Pls help

Its urgent

Cheers,
Anand

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-25 : 06:17:02
Duplicate question
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=36723

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

B0g
Starting Member

19 Posts

Posted - 2004-06-25 : 06:47:40
Try this one:

SELECT TOP 10 * FROM [anand-new].[NEWSITE].[DBO].[Xyz_NEW]
Go to Top of Page
   

- Advertisement -