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.
| Author |
Topic |
|
safderalimd
Starting Member
32 Posts |
Posted - 2008-07-02 : 13:49:14
|
| How can I handle single quotes that are passed in as part of input parameters to SQL stored procedure. For example if I have a stored proc to insert employee data and column value for name may or may not have single quote in it.INput parameter value:Sample 1) @name = 'sam'Sample 2) @name = 'sam's' |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-02 : 13:51:46
|
| Double the single quote 'sam''s'MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-02 : 13:55:01
|
| or use QUOTENAME function |
 |
|
|
safderalimd
Starting Member
32 Posts |
Posted - 2008-07-02 : 13:55:41
|
| You mean, calling applicaiton program weather it might be PHP, ASP or JAVA should take care of replacing single quote with double quote before calling stored procedure? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-02 : 13:57:29
|
quote: Originally posted by safderalimd You mean, calling applicaiton program weather it might be PHP, ASP or JAVA should take care of replacing single quote with double quote before calling stored procedure?
Yes it is Note that thats not double quote, single quote entered twice MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|