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 |
lloydsj
Starting Member
7 Posts |
Posted - 2003-06-24 : 05:19:25
|
Basically I am storing some text in a SQL Database, field type VARCHAR. This text sometimes includes the ' character. For example when storing names like O'Conner etc. It gets stored fine, but whenever I try and search for this it returns an error.I know this error is because ' is used in SQL. However, What is the best way to get rid of this error? Shall I just not let them input it at all in the first place? or is there a way of changing it a bit so that when my search parameter gets passed through to the search stored procedure, it does not return an error?Also is there a list of characters which will return similar errors? |
|
mr_mist
Grunnio
1870 Posts |
Posted - 2003-06-24 : 05:25:19
|
What is your user interface?If you're using ASP or similar, you can make use of the replace function to change ' to '' (that's two single quotes.) This can be used both for insert / update and for select.-------Moo. |
|
|
lloydsj
Starting Member
7 Posts |
Posted - 2003-06-24 : 05:52:50
|
Yep, im using ASP.And yep, replace worked great. Cheers. |
|
|
|
|
|