Click here to Skip to main content
15,905,782 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am getting an error
Incorrect syntax near 's'.

I have a query :
INSERT INTO K2_NQISQI VALUES('June-14','GSM NQI','AP',97.83,96.71,'down','RF KPI's' Degraded mainly because of high blocking cells(Increased from 0.13 to 0.23) (Rollout issues)  and because of Non DG site outages on 15th16th20th23rd 24th26th 27th and 29th resulting in 400 sites outage and about 220 sites outages on 27th and 29th due to Dual Fiber cuts.')


Should i need to put "" instead of '

Thanks in advance
Harshal
Posted
Comments
Thanks7872 17-Jul-14 7:04am    
Should i need to put "" instead of ' It just takes second to replace it. Why not to just try it before asking some thing?

Hi,

check this one.

SQL
INSERT INTO K2_NQISQI VALUES('June-14','GSM NQI','AP',97.83,96.71,'down','RF KPI''s'' Degraded mainly because of high blocking cells(Increased from 0.13 to 0.23) (Rollout issues)  and because of Non DG site outages on 15th16th20th23rd 24th26th 27th and 29th resulting in 400 sites outage and about 220 sites outages on 27th and 29th due to Dual Fiber cuts.')


Hope this will help you.
 
Share this answer
 
Comments
[no name] 17-Jul-14 7:35am    
Thanks Buddy
its work .
Magic Wonder 17-Jul-14 8:49am    
Your welcome.
Magic Wonder 17-Jul-14 8:52am    
Hey, take a note of one thing that inserting " ' " with your data in database means you are inviting SQL injections. Kindly take care of these SQL injections.
I am not that sure but the section
'RF KPI's' - seams quite strange to me
should n't it be 'RF KPI''s'

is 'RF KPI's' Degraded.... altogether ?
 
Share this answer
 
v2
Try like this :
SQL
INSERT INTO K2_NQISQI VALUES('June-14','GSM NQI','AP',97.83,96.71,'down','RF KPI"s Degraded mainly 
because of high blocking 
cells(Increased from 0.13 to 0.23) (Rollout issues)  and because of Non DG site outages on 15th16th20th23rd 
24th26th 27th and 29th 
resulting in 400 sites outage and about 220 sites outages on 27th and 29th due to Dual Fiber cuts.')
 
Share this answer
 
Further to Solution 1 (which is correct and highlights the exact problem)

If you have single quotation marks within a string then you need to "escape" it by using another single quote - that is two single quotes in 'RF KPI''s' not a double-quote.

Alternatively you can insert the ascii character for single-quote ... see the discussion at sql server forums[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900