SQL获取某表的索引或约束,并确定索引归属列,获取表中的自动增长列名。

--获取某表的所有索引,包括索引归属列名
sp_statistics 'corpinfo'
--获取索引与索引归属列以及描述信息
sp_helpindex 'corpinfo'
--获取某表的约束信息以及归属列
sp_helpconstraint 'corpinfo'
--获取某表中的自动增长列的列名
select   name   from   syscolumns   
  where   id=object_id('corpinfo')   and   status   &   128   =   128
--获取某表中的自动增长列的列名
select   name   from   syscolumns   
  where   id=object_id('corpinfo')   and     
                COLUMNPROPERTY(id,name,'IsIdentity')=1