Routine to get index details

  • I am trying to create a routine ro generate drop and create index scripts for a db. The following is the link I am following( this one looks good).

    http://www.code-magazine.com/Article.aspx?quickid=0301101

    However,

    There is an sp missing in it, here is the part of the code calling it:

    Set @TableID = (Select Min(TableID)

    From dbo.#TempSysindexes

    Where IsHypothetical =0)

    Select @TableOwner = TableOwner, @TableName = TableName

    From dbo.#TempSysindexes

    Where TableID = @TableID

    While @TableID Is Not Null

    Begin

    Set @IndexName = (Select Min(IndexName)

    From dbo.#TempSysindexes

    Where TableID = @TableID And IsHypothetical =0)

    While @IndexName Is Not Null

    Begin

    Exec Utilities.dbo.usp_GetIndexKeys ' + @DbName+ ', @TableOwner, @TableName, @IndexName, @KeyString OUTPUT, 0

    If @KeyString Is Not Null

    Update dbo.#TempSysindexes

    Set IndexKeyString = @KeyString

    Where TableID = @TableID And IndexName = @IndexName

    The usp_GetIndexKeys proc is what I would like to get.

    It would be gr8 if you could help.

    Thanks... 🙂

  • Google ....

    http://www.eps-publishing.com/Article.aspx?quickid=0301101

    is this what you are after?

    HTH

    gah

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • That exactly is the issue, but that proc source code is not there in that link as well.

  • Hi

    I havent tested the code but the comments posted against the artice say

    "usp_GetIndexKeys should have been usp_GetIndexColumns"...that script is there in the post.

    gah

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Hey..thank u so much.. I really did not notice the comments 🙂

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

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