1.利用sp_help查看表的基本信息,包括表名\列名,各列的类型\长度,约束类型,主键等
sp_help 'table1'
2.利用information_schema,可以查看各字段的全部信息
select * from information_schema.columns where table_name='test'
3.利用sysconstraints 查看表的主键
select colid from sysconstraints where id=object_id('tablename') and (status &1)=1
4.利用sp_helpconstraint察看表中的各自段的约束
sp_helpconstraint sysconstraint
5.利用sp_mshelpcolumns,功能同上2
mshelpcolumns 'table1'