得到表1中列1的数据类型:
SELECT 类型=b.name
FROM syscolumns a
left join systypes b on a.xtype=b.xusertype
inner join sysobjects d on a.id=d.id and d.xtype='U' and d.name<>'dtproperties'
left join syscomments e on a.cdefault=e.id
left join sysproperties g on a.id=g.id and a.colid=g.smallid
where d.name='表1' and a.name='列1'
order by a.id,a.colorder
SELECT 类型=b.name
FROM syscolumns a
left join systypes b on a.xtype=b.xusertype
inner join sysobjects d on a.id=d.id and d.xtype='U' and d.name<>'dtproperties'
left join syscomments e on a.cdefault=e.id
left join sysproperties g on a.id=g.id and a.colid=g.smallid
where d.name='表1' and a.name='列1'
order by a.id,a.colorder
'Data Type' = typ.name
FROM sysobjects tbl
JOIN syscolumns col
ON tbl.id = col.id
JOIN systypes typ
ON col.xusertype = typ.xusertype
WHERE tbl.type = 'U'
AND tbl.name = 'table name'