• 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'

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass