Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

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: Yesterday @ 8:35 PM
Points: 1,208, Visits: 2,034
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-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Saturday, December 3, 2016 5:18 AM
Points: 45,619, Visits: 44,147
Put square brackets around the linked server name.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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: Tuesday, June 7, 2016 5:15 AM
Points: 2,562, Visits: 2,643
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: Yesterday @ 8:35 PM
Points: 1,208, Visits: 2,034
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: 2 days ago @ 7:33 AM
Points: 251, Visits: 1,144
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: Saturday, October 11, 2014 1:28 AM
Points: 4, Visits: 16
I apply foreign key on my table but when i am add value its generate error of primary key
Post #1558759
Posted Tuesday, October 4, 2016 1:59 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 10, 2016 9:26 PM
Points: 7, Visits: 11
SELECT 'KESELURUHAN' AS STATE,
'KESELURUHAN' AS BRANCH,
dbo.uf_get_koddana(h.funding_scheme) AS Dana,
Count(*) AS cnt_all,
Sum(h.approved_limit) AS sum_all,
Sum(isnull(w.wo_amt,0)) AS sum_wo,
Sum(isnull(RECOVERED_AMOUNT,0)) AS sum_wb,
Sum(case when bulantgkbil >= 7 and h.account_status not in (1,9,15) then 1 else 0 END) AS cnt_npl,
Sum(case when bulantgkbil >= 7 and h.account_status not in (1,9,15) then isnull(instal_arrears,0) - isnull(income_arrears,0)
Else 0 END) AS npl_costarr,
Sum(case when bulantgkbil >= 7 and h.account_status not in (1,9,15) then isnull(income_arrears,0) else 0 END) AS npl_prftarr,
Sum(case when account_status = 9 then 1 else 0 END )as bil_wo
FROM dbo.account_history h,
dbo.Write_off_report w
WHERE ssma_oracle.trunc(h.report_date) = convert(DATETIME, '2016-06-30')
AND h.account_no = w.new_account (+)
AND h.account_status not in (2,16)
GROUP by dbo.uf_get_koddana(h.funding_scheme)


what im missing?? im getting this error : Msg 102, Level 15, State 1, Line 16
Incorrect syntax near ')'.
Post #1823199
Posted Tuesday, October 4, 2016 2:49 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:42 AM
Points: 7,059, Visits: 14,762
Assuming you're running this in SSMS, you can double-click on the error and it'll take you to the line in the code. In this instance, I think it's the "(+)". What is that supposed to do?

John
Post #1823214
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse