Index ID

  • Hi All,

    How can we find out ID of a Index in a table. Its a nonclustered index.

    Thank You.

    Regards,
    Raghavender Chavva

  • 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:

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • ...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!

    😎

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • Thanks a lot Buddy, I got answer.

    Thank You.

    Regards,
    Raghavender Chavva

  • Raghavender (10/4/2008)


    Thanks a lot Buddy, I got answer.

    You get the answer from here or from other resources!

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply