The creation of the table, with a column of the SQL_VARIANT type. : SQL_VARIANT « Data Types « SQL Server / T-SQL Tutorial






5> CREATE TABLE Item_Attributes (
6>           item_id INT NOT NULL,
7>           attribute NVARCHAR(30) NOT NULL,
8>           value SQL_VARIANT NOT NULL,
9>           PRIMARY KEY (item_id, attribute))
10> GO
1>
2> drop table Item_Attributes;
3> GO








5.22.SQL_VARIANT
5.22.1.sql_variant data type is designed to allow a single variable, column, or parameter to store values in different data types.
5.22.2.The creation of the table, with a column of the SQL_VARIANT type.
5.22.3.Insert different type of values into a sql_variant column
5.22.4.sql_variant type column
5.22.5.Select case and cast SQL_VARIANT
5.22.6.Comparing SQL_VARIANTs