SQL SERVER数据库索引、外键查找

1、索引查找

select a.name as tabname
,h.name as idname,h.type_desc
from sys.objects as a
right join sys.indexes as h on a.object_id=h.object_id
where a.type<>'s'
order by tabname
go

2、外键查找

select a.name as tabname
,h.name as idname,h.type_desc
from sys.objects as a
right join sys.foreign_keys as h on a.object_id=h.parent_object_id
where a.type<>'s'
order by tabname
go

posted @ 2014-04-21 13:16  xiaofoyuan  阅读(2288)  评论(0编辑  收藏  举报