March 30, 2009 at 1:57 pm
Hi,
How can I get a table_name per known index_name?
Thanks!
March 30, 2009 at 2:07 pm
You can check in sys.indexes, though note that index names don't have to be unique across the database, just unique on a table, so there may be two or more indexes with the same name on different tables
select name, object_name(object_id) AS TableName from sys.indexes
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 30, 2009 at 2:10 pm
select o.name,
i.name
from sysobjects o,
sysindexes i
where i.id=o.id
and type in ('U','V')
and i.name = 'INDEX_NAME'
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.March 30, 2009 at 2:17 pm
Thanks a lot, it helped!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply