1

SQL: Rebuild Indexes, Update Statistics, and Shrink Databases on SQL Server

SQL to Rebuild Indexes, Update Statistics, and Shrink Databases

Here is SQL to Rebuild Indexes, Update Statistics, and Shrink Databases on SQL Server. This code works on SQL Server 2008 – 2016. It should help keeping your databases running at their peak performance. Just alter the settings as appropriate and away you go! Older legacy SQL2000 kept in for reference.

  • kcwilsonii

    Wow, kudos. Was about write something like this myself. Have a very large database I have to shrink and knew I would have to do it in steps. Excellent code.