Becareful here. SQL Server will not be able to optimize this query with an index and will resort to a table scan. In general, SQL Server can only optimize those clauses that are in the form
column =
literalLIKE is another one that can bite you. SQL Server can optimize this:
column LIKE
'b%'because it will convert it to
column >=
'b' AND column <
'c'but it can't optimize
column LIKE
'%b'Now, sometimes you have no choice. If it the only way to get the job done, then you do it that way.
-Mike