January 12, 2011 at 10:46 am
We were recently upgraded to a SQL 2008. In the past, if I wanted to search for text that inadvertently contained something SQL would recognize as a command, I would contain it in quotations: For example select * from table where column 1 = '"Dad's"'
and that would return it. Now if I do that, it recognizes the apostrophe as the end of the field. Is there an easy way to deal with this?
Thanks,
Teena
January 12, 2011 at 10:59 am
something like this works...the important part is that two single quotes in a row is the escape sequence, so it can be contained within single quotes:
select * from yourtable where yourfield like '%''%' --contains at least one apostrophe
Lowell
January 12, 2011 at 11:03 am
Thank you. I have text that needs to be updated to include an apostrophe as it will print on a document. So, if I want to update the text to include an apostrophe, how would I do that?
For instance
Update table1
set title = 'Daddy's Daycare'
January 12, 2011 at 11:20 am
teh same escape method: two single quotes in a row:
For instance
Update table1
set title = 'Daddy''s Daycare'
Lowell
January 12, 2011 at 12:11 pm
Thank you very much!
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply