select i.name,[Type]=case when i.is_unique=1 and is_primary_key=1 then '主键'
when i.is_unique=1 and is_primary_key=0 then '唯一键'
else '索引' end,TypeRemark=i.type_desc
from sys.indexes i
where i.[object_id]=object_id('表名') and i.name is not null
union select f.name,'外键',OBJECT_NAME(f.referenced_object_id)
from sys.foreign_keys f
where f.parent_object_id=object_id('表名')
union select d.name,'默认值',d.[definition] collate Latin1_General_CI_AS_KS_WS
from sys.default_constraints d
where d.parent_object_id=object_id('表名')
union select c.name,'约束值',c.definition collate Latin1_General_CI_AS_KS_WS
from sys.check_constraints c
where c.parent_object_id=object_id('表名')