May 9, 2006 at 4:47 pm
Please someone help. My data is like this:
BookId Notes
111 My aunt's favorite book is self-help
My job will failed if it sees a single quote like that, but it will work with
My aunt''s favorite book is self-help.
How can I go around this?
I want to update my notes field to 2 single quotes to prevent the failure of the job.
Thanks in advance.
Minh Vu
May 9, 2006 at 5:19 pm
Well, to do what you want, this would work:
UPDATE MyTable
set Notes = REPLACE(Notes, '''', '''''')
But more importantly, tell us why / how your job is failing and we should be able to help you out.
May 9, 2006 at 6:17 pm
Don't use dynamic SQL.
But if you really need to use dynamic SQL learn how to use parameters with sp_executesql.
_____________
Code for TallyGenerator
May 10, 2006 at 9:04 am
This is what you do you use double quotes around words with apostrophe. Try the link below for more about using delimiters.
My "aunt's" favorite book is self-help.
Hope this helps.
http://msdn2.microsoft.com/en-US/library/ms176027.aspx
Kind regards,
Gift Peddie
Kind regards,
Gift Peddie
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply