SQLServer中获取特定表的所有列名

1.获取特定表的所有列名:

Select Name FROM SysColumns Where id=Object_Id('tableName')

参考:http://blog.csdn.net/wuxiaokaixinguo/article/details/8293039

2.获取特定表的所有列名和备注信息

SELECT
a.column_id AS No,
a.name AS 列名,
isnull(g.[value],'-') AS 说明
FROM
sys.columns a left join sys.extended_properties g
on (a.object_id = g.major_id AND g.minor_id = a.column_id)
WHERE
object_id =
(SELECT object_id FROM sys.tables WHERE name = 'tableName')
上一篇:mysql创建存储过程


下一篇:swift 用协议实现代理传值功能