方法一: 取得表里所有列名称
Select Name FROM SysColumns Where id=Object_Id('表名')
方法二: 取得有关数据库对象(sysobjects 表中列出的任何对象)
sp_help 表名也可直接sp_help 获取所有表
方法三:取得库内所有表的名称+字段类型
Select * From INFORMATION_SCHEMA.COLUMNS
方法四:取某个表的所有字段
declare @objid int,@objname char(40)set @objname = '表名'select @objid = id from sysobjects where id = object_id(@objname)select'Column_name'= name from syscolumns where id = @objid order by colid
方法五:获取特定表的所有列名和备注信息
SELECTa.column_id AS No,a.name AS 列名,isnull(g.[value],'-') AS 说明FROMsys.columns a left join sys.extended_properties g on (a.object_id = g.major_id AND g.minor_id = a.column_id)WHEREobject_id =(SELECT object_id FROM sys.tables WHERE name = '表名')