GilaMonster (3/28/2014)
INT has a higher precedence than string, the string will convert to int, so if that is an int column (which we don't know), then the query will be essentially
SELECT @ProductID= ProductID FROM Product WITH (NOLOCK) WHERE SalesID= CONVERT_IMPLICIT(INT, '@salesId') and Product = 'Clothes '
Which is SARGable and going to fail with a conversion error.
If you don't believe me, try running this:
IF ('This is a string' = 1)
print 'True'
Guess I'm guilty here:-P neither do I know the data type of the column nor the variable (being passed as char), have to learn to think before talk....:w00t:
Still leaves the original questions unanswered.
Thanks Gail for correcting my wrong her!