• Thanks for the question, Jason.

    I only got it right because "3, 3, 1" was not in the answer options - that was the answer I was looking for after reading the question. I am also a bit disappointed that this part of the answer is not explained. One of the links included in the explanation includes this quote:

    When the right side of a LIKE predicate expression features a value with a trailing space, SQL Server does not pad the two values to the same length before the comparison occurs.

    That quote only reinforces my expectation that the third query should return 1. Can anyone explain to me why it doesn't?

    (And, while you're at it, you might also want to explain the even stranger behaviour demonstrated by the query Paul posted in this topic).


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/