• Ouch! This doesn't take into account the sort order of the keys! It will identify these two indexes as duplicate:

    CREATE NONCLUSTERED INDEX [idx01] ON [dbo].

    (

    [d5comp] ASC,

    [d5jbns] ASC

    )

    CREATE NONCLUSTERED INDEX [idx02] ON [dbo].

    (

    [d5comp] ASC,

    [d5jbns] DESC

    )

    Pretty sure that's not correct.