sqlserver查看表结构

SELECT t.name AS TableName, c.name AS ColumnName, c.system_type_id AS DataTypeID, s.name AS DataTypeName, c.max_length AS MaxLength, c.is_nullable AS IsNullable
FROM sys.tables t
INNER JOIN sys.columns c ON t.object_id = c.object_id
LEFT OUTER JOIN sys.types s ON c.user_type_id = s.user_type_id
WHERE t.name = 'YourTableName' --将"YourTableName"替换为要查询的表名
ORDER BY t.name, c.column_id;

 

posted @ 2024-03-19 10:55  zhaoguanhao  阅读(27)  评论(0编辑  收藏  举报