>>>This doesn't work for obvious reasons. I'm trying to find all records that have an apostrophe in the DocumentName field.
>>>
>>>WHERE H.DocumentName LIKE '%'%'
>>>
>>
>>Just double it:
>>
>>WHERE H.DocumentName LIKE '%''%'
>>
>
>I'm sure it works, but what is the logic with that? That makes no sense to me at all.
In SQL Server you should always escape single quote, so you must double it. You can also try to use different string delimiters than single quote, but then you should turn on some flag.
If it's not broken, fix it until it is.
My Blog