• Christian Buettner-167247 (12/12/2011)


    Maybe I have missed it, but is there any plausible reason to order by a SQL_VARIANT column, given the unintuitive sorting semantics? What problem can I solve with that order?

    A well-defined sort order for SQL_VARIANT is a requirement to be able to build indexes on it.

    I don't think there is any other reason to use comparisons (other than equal to or unequal to) on SQL_VARIANT data.


    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/