October 4, 2008 at 2:41 pm
Hi All,
How can we find out ID of a Index in a table. Its a nonclustered index.
Thank You.
Regards,
Raghavender Chavva
October 4, 2008 at 3:48 pm
For fast information try this:
SELECT OBJECT_ID, NAME, INDEX_ID, TYPE_DESC FROM sys.indexes
WHERE NAME= 'yor_index_name'
Hope it helps you!
:hehe:
October 4, 2008 at 3:57 pm
...or if you want to know this information usually, you can use this procedure:
Creating the Procedure:
CREATE PROCEDURE USP_FIND_INDEX_ID
@TABLE_NAME VARCHAR(200)
AS
SELECT O.NAME, I.OBJECT_ID, I.NAME, I.INDEX_ID, I.TYPE_DESC
FROM sys.objects O INNER JOIN sys.indexes I ON O.object_id = I.object_id
WHERE O.name = @TABLE_NAME;
GO
then
executing like here:
EXEC USP_FIND_INDEX_ID
your_table_name;
This procedure will find all indexes per table!
So if you have many indexes in your table use the first one if you do not have many indexes you can use the procedure to find all indexes per table!
Cheers!
😎
October 4, 2008 at 4:05 pm
Thanks a lot Buddy, I got answer.
Thank You.
Regards,
Raghavender Chavva
October 4, 2008 at 4:27 pm
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply