Checking for bracketed varchar in SQL Server
I'm trying to pattern match a string that would look like this:
[I am a varchar contained in brackets]
This doesn开发者_StackOverflow社区't work:
LIKE '[[]%[]]'
Is my only option to use 2 and statements:
LIKE '%[]]' AND LIKE '[[]%'
I don't think you're escaping special characters correctly. Here's how you can do it:
where foo like '\[%\]' escape '\'
精彩评论