查找特定索引属于哪个表

时间:2022-07-31 16:30:01

If I have the name of an index, what query can I use to find what table the index belongs to?

如果我有索引的名称,我可以使用什么查询来查找索引属于哪个表?

3 个解决方案

#1


18  

SELECT OBJECT_NAME(object_id) FROM sys.indexes WHERE name = '...'

#2


5  

try this:

试试这个:

Select object_Name(Id) IndexName,
  object_name(parent_Obj) Tablename
From SysObjects
Where Type In ('K', 'F')
order By object_name(parent_Obj), 
         object_Name(Id)

#3


0  

I used a slightly different approach than Lukasz since my index wasn't of type k or f.

我使用的方法与Lukasz稍有不同,因为我的索引不是k或f类型的。

Select object_Name(Id) IndexName,
object_name(parent_Obj) Tablename
From SysObjects
where object_name(id) like 'MyIndexName'
order By object_name(parent_Obj), 
         object_Name(Id)

#1


18  

SELECT OBJECT_NAME(object_id) FROM sys.indexes WHERE name = '...'

#2


5  

try this:

试试这个:

Select object_Name(Id) IndexName,
  object_name(parent_Obj) Tablename
From SysObjects
Where Type In ('K', 'F')
order By object_name(parent_Obj), 
         object_Name(Id)

#3


0  

I used a slightly different approach than Lukasz since my index wasn't of type k or f.

我使用的方法与Lukasz稍有不同,因为我的索引不是k或f类型的。

Select object_Name(Id) IndexName,
object_name(parent_Obj) Tablename
From SysObjects
where object_name(id) like 'MyIndexName'
order By object_name(parent_Obj), 
         object_Name(Id)