SQL View data type

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.