• A good question about a common misunderstanding. The number of times when a problem posted to usenet or forums could be solved by simply adding the length to a varchar parameter is staggering.

    My only minor gripe is, as already noted by others, the lack of collate indication. On my default test server, this query would have returned 1 row, as I use a case sensitive collation there. Fortunately I assumed out of the box default settings for the instance, so I replied 4 and got it right.

    Thanks for the great question; I'm looking forward to seeing more of these, Greg!


    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/