• Unless the database is very small, this script will blow up the tran log.

    Things I would change or add to this script:

    1. Abort the script if the specified/current database is mirrored or replicated.

    2. Abort the script if a user tried to run it on a system database.

    3. Use Truncate Table instead of Delete From for improved performance, to prevent tran log bloat, and to reset identity values.

    4. Get rid of cursors (not needed).


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]