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 |
|
bobbabuoy
Starting Member
33 Posts |
Posted - 2004-06-14 : 06:28:44
|
| Ok, I still have some uncertainty as to just exactly how this whole apostrophe thing works with databases. I understand that it is a reserved character and so when a sql query runs into one of these creatures it looks at it as something other than a normal character.I am working primarily in vb/asp/sql server with a little bit of access. I am familiar with the instrinsic 'Replace' function and I use it but I still have occassional problems.I would like any information I can get on just exactly why/how this thing works and how to work-around the apostrophe when writing to, reading from, and validating data from sql server/access/any databases.Thanks! |
|
|
gpl
Posting Yak Master
195 Posts |
Posted - 2004-06-14 : 06:37:25
|
| it is a string delimiter, the same as in VBif you want to use a " in a VB string, you would do this """Help"" he said"Its the same in SQL, except it is a single quoteso if you have the name O'Brian, you would use 'O''Brian'In your stored procedures, just ensure that all your string parameters are modified to saySet @Param = Replace(@Param, '''', '''''')When you read stuff back, the correct number of quotes will appear in the string where necessaryGraham |
 |
|
|
|
|
|