BP024
Published 24 N 2017
SQL_VARIANT datatype is used
The
SQL_VARIANT
datatype stores values from several different data types and is used internally by SQL Server. It is not part of the SQL standard and has limited uses in a relational database. It needs to be handled with care because its misuse will lead to performance problems and bugs that are hard to track down. It is only safe to store data as a SQL_VARIANT
, if you explicitly convert it to its true type before you use it.A SQL_VARIANT
cannot be passed directly to some SQL operators and functions such as LIKE
, SUM()
, or AVG()
and cannot be returned to an application via ODBC, except as binary data.
For details and worked examples, see this Product Learning article: Problems Caused by Use of the SQL_VARIANT Datatype .