查詢欄位
select name from syscolumns where id=object_id('TableName')
查詢欄位、型態
SELECT OBJECT_NAME(c.OBJECT_ID) TableName,
c.name AS ColumnName,
t.name AS TypeName
FROM sys.columns AS c
JOIN sys.types AS t ON c.user_type_id = t.user_type_id
WHERE c.OBJECT_ID = (
SELECT id
FROM sysobjects
WHERE XTYPE = 'U' AND NAME = 'TableName'
)