SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '-'.


Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '-'.

Author
Message
forsqlserver
forsqlserver
SSCarpal Tunnel
SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)

Group: General Forum Members
Points: 4552 Visits: 2060
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
GilaMonster
GilaMonster
SSC Guru
SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)SSC Guru (224K reputation)

Group: General Forum Members
Points: 224334 Visits: 46312
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


Ramesh Saive
Ramesh Saive
SSCertifiable
SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)

Group: General Forum Members
Points: 6738 Visits: 2643
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


forsqlserver
forsqlserver
SSCarpal Tunnel
SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)

Group: General Forum Members
Points: 4552 Visits: 2060
I have just one word ...Thancs

Thanks
walterbayliss
walterbayliss
Valued Member
Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)

Group: General Forum Members
Points: 64 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?
david.alcock
david.alcock
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1269 Visits: 1204
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'
walterbayliss
walterbayliss
Valued Member
Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)

Group: General Forum Members
Points: 64 Visits: 2
Awesome!
thanks!

Cheers.
Walt
farahnasir969
farahnasir969
SSC Rookie
SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)SSC Rookie (40 reputation)

Group: General Forum Members
Points: 40 Visits: 16
I apply foreign key on my table but when i am add value its generate error of primary key
nazirulfitrifauzi
nazirulfitrifauzi
Valued Member
Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)

Group: General Forum Members
Points: 53 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 ')'.
John Mitchell-245523
John Mitchell-245523
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34661 Visits: 16661
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search