Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '-'. Expand / Collapse
Author
Message
Posted Tuesday, June 2, 2009 5:27 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, September 19, 2014 8:15 AM
Points: 1,202, Visits: 1,937
If I have connected a linked server whose name is: cic-nic-2

When I running query : select * from cic-nic-2.Arrow.dbo.circle


it is giving error :
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '-'.

One thing more if I want to run this query using server IP address not with name could it be possible.


Thanks

Post #727325
Posted Tuesday, June 2, 2009 5:35 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 6:44 AM
Points: 39,874, Visits: 36,218
Put square brackets around the linked server name.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #727335
Posted Tuesday, June 2, 2009 5:35 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, October 21, 2013 12:32 AM
Points: 2,551, Visits: 2,593
You have to enclose the object names in [] when the object name contains special characters, keywords etc.

select * from [cic-nic-2].Arrow.dbo.circle



--Ramesh

Post #727336
Posted Tuesday, June 2, 2009 5:58 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, September 19, 2014 8:15 AM
Points: 1,202, Visits: 1,937
I have just one word ...Thancs

Thanks

Post #727354
Posted Thursday, February 3, 2011 5:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 3, 2011 2:12 PM
Points: 2, Visits: 2
Thanks Guys.

What about this one.

SELECT _BODY from aaa.dbo.aaa2 REPLACE('from a blogis easy', 'blogis', 'blog is')

I am getting the same error - Have tried Square brackets every where. to no avail.

Any clues?
Post #1057992
Posted Thursday, February 3, 2011 7:47 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, September 19, 2014 8:16 AM
Points: 215, Visits: 862
Try:


SELECT _BODY, REPLACE('from a blogis easy', 'blogis', 'blog is') from aaa.dbo.aaa2

The replace needs to be in the SELECT before the FROM clause.


'Only he who wanders finds new paths'
Post #1058086
Posted Thursday, February 3, 2011 2:12 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 3, 2011 2:12 PM
Points: 2, Visits: 2
Awesome!
thanks!

Cheers.
Walt
Post #1058374
Posted Saturday, April 5, 2014 11:33 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 17, 2014 2:07 AM
Points: 4, Visits: 12
I apply foreign key on my table but when i am add value its generate error of primary key
Post #1558759
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse