• Hello,

    The script has been executed in SQL Server 2008 R2 and it works fine, please try this again eliminated the "ORDER BY DESC COUNT_ROWS".

    Regards. 🙂

    Fernando Casas Osorio