Two different ways to view:
One.
Sql_variant_property (expression, property)
Property:
1.BaseType SQL Server data types
2.Precision number of digits of a numeric base data type
3.Number of digits after the decimal point for the scale numeric base data type
4.TotalBytesThe number of bytes required to accommodate both the value's metadata and the data. This information is useful when examining the largest side of the data in the sql_variant column. if the value is greater than 900, the index creation will fail.
5. Collation represents a collation for a specific sql_variant value.
6. MaxLength maximum data type length (bytes). nvarchar ( # ) is a, MaxLength of int is 4. " For example, nvarchar ( MaxLength is the int MaxLength is 4.
eg
Select Sql_variant_property (ID, ' BaseType ')
Sql_variant_property (ID, ' Precision ')
Sql_variant_property (ID, ' scale ')
From TB
Two.
Select object_name (ID) Table name,
C.name Field Name,
T.name data type,
C.prec length
From syscolumns C
INNER JOIN systypes t
On C.xusertype=t.xusertype
where OBJECTPROPERTY (ID, ' isusertable ') =1 and id=object_id (' TB ')
SQL View data type