I have a pretty complex query and was fixing my like terms (which I have as a separate db table and load them into my search query), but when I parameterize it, my query gives different results.
So the old query had a like section like so:
((v.title = ''BA'') OR (vs.label = ''BA'') OR
(v.title LIKE ''BA %'') OR (vs.label LIKE ''BA %''))
...
And I replaced it with something like this (with parameters):
((v.title = @banone) OR (vs.label = @banone) OR
(v.title LIKE @baright) OR (vs.label LIKE @baright))
...
@banone=N'BA',@baright=N'BA %',
...
My parameters get added like so:
string key = "ba";
string val = "ba";
parameters.Add("@" + key + "none", val);
parameters.Add("@" + key + "right", val + " %");
Are these two queries equal? Am I missing something?