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
 SQL Server Development (2000)
 Singel Quote Problem

Author  Topic 

shubhada
Posting Yak Master

117 Posts

Posted - 2007-06-13 : 02:29:51
I have one procedure call as follow

cm_insert_test 'O'Marry',NUll,'This is invalid'

the first parameter is EmpName
Second is the Date and Third parameter is Error Message.

I am getting this call from front end application.

when i executed this call, i am getting the following error
Incorrect syntex near O

Please tell me how I can handle this.

SQLTeam

pootle_flump

1064 Posts

Posted - 2007-06-13 : 02:33:57
Escape the quote

cm_insert_test 'O''Marry',NUll,'This is invalid'

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-13 : 02:34:17
use 2 single quote

cm_insert_test 'O''Marry',NUll,'This is invalid'



KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-13 : 02:34:41
by 21 secs


KH

Go to Top of Page

pootle_flump

1064 Posts

Posted - 2007-06-13 : 02:37:14
quote:
Originally posted by khtan

by 21 secs


KH



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-13 : 09:24:38
Inside a single quote you need to double it

See here how it works

Select '','''','''''','''''''',''''''''''

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-06-13 : 11:21:35
If you are using parameterized queries you should not have to worry about escaping any quotes.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -