Miscellaneous Data Types in SQL Server

In SQL, we have different datatypes that will not come under string datatypes, binary data types, date and time and numeric datatypes those will be called miscellaneous or other data types.

 

In SQL, we have a different type of miscellaneous data types available, those are

 

  • cursor datatype
  • XML datatype
  • table datatype
  • uniqueidentifier datatype
  • sql_variant datatype

SQL Cursor DataType 

In SQL, we can use cursor datatype to hold a reference of cursor objects. Any variables created with cursor datatype are nullable and cursor datatype cannot be used for a column while creating a table.

XML DataType in SQL Server

In SQL, we will use XML datatype to store XML formatted data in the column. In the XML datatype column, we can store a maximum of 2 GB data.

Table DataType in SQL Server

In SQL, table datatype will be useful to store a table result set in variable for processing later time. The table variables can be used in stored procedures, functions and these variables cleaned up automatically at the end of function or stored procedures.

Uniqueidentifier DataType in SQL Server

In SQL, the uniqueidentifier datatypes are used to store a globally unique identifier (GUID).

sql_variant DataType in SQL Server

In sql, sql_variant datatype is used to store a various sql supported data types like int, char, binary, etc.

 

The following table shows more details about miscellaneous data types in the SQL Server.

 

Data TypeDescription
cursor It is used to store a reference to cursor object
XML It is used to store XML formatted data and we can store maximum 2GB data
table It is used to store table result set for processing at a later time
uniqueidentifier It is used to store globally unique identifier (GUID)
sql_variant It is used to store values of various sql supported data types except text,ntext, varchar(max), xml, etc… We can store a maximum of 8000 bytes