SQL Server lists the columns and properties for each table

Source: Internet
Author: User

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 USE DBProjectSY GO SELECTOBJECT_SCHEMA_NAME(T.[object_id], DB_ID()) AS [架构名] ,         T.[name] AS [表名] ,         AC.[name] AS [列名] ,         TY.[name] AS [系统数据类型] ,         TY.is_user_defined AS [是否用户自定义类型],--1 = 用户定义类型,0 = SQL Server 系统数据类型         AC.[max_length] [最大长度],         AC.[precision] [精确度],--如果列包含的是数值,则为该列的精度;否则为0         AC.[scale] [数值范围],--如果列包含的是数值,则为列的小数位数;否则为0         AC.[is_nullable] [是否允许为空],         AC.[is_ansi_padded][是否使用ANSI_PADDING]--1 = 如果列为字符、二进制或变量类型,则该列使用ANSI_PADDING ON 行为 FROMsys.[tables] AS T         INNER JOIN sys.[all_columns] AC ON T.[object_id] = AC.[object_id]         INNER JOIN sys.[types] TY ON AC.[system_type_id] = TY.[system_type_id]                                      AND AC.[user_type_id] = TY.[user_type_id] WHERET.[is_ms_shipped] = 0 ORDER BY T.[name] ,         AC.[column_id]

  

Related Article

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.