• This is a great proc; I've been using something similar for a while, but this adds in a few more useful columns. One thing that's baffling me however is that some of the highest results from this proc I've subsequently added indexes for, and they still turn up (unlike most instances where as soon as the index is added, they disappear from the proc results).

    For example, from the proc results:

    schema name = Analysis

    Table name = Notice

    Equality = NULL

    Inequality = [NoticeStageID]

    Include = [ID], [AnalysisID], [FileID]

    Score = 25953.496496

    I've then added the index

    CREATE INDEX [ixAnalysisHolding_AnalysisID_CustodianBeneficialOwnerID]

    ON [Analysis].[AnalysisHolding]

    ([AnalysisID], [CustodianBeneficialOwnerID])

    INCLUDE([ID], [RegisteredHolderBeneficialOwnerID], [BeneficialOwnerInvestorID], [Shares])

    WITH ( FILLFACTOR = 90 );

    and no difference to the proc results. What's going on? Am I missing the significance of the "Inequality" column, or is this a factor of the way the DMVs work?