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

9/1/2015来源:SQL技巧人气:2680

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

1、索引查找

select a.name as tabname ,h.name as idname,h.type_descfrom 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_descfrom sys.objects as a right join sys.foreign_keys as h on a.object_id=h.parent_object_idwhere a.type<>'s' order by tabnamego