Home   , Contact: jchang6 at yahoo.com or jchang61 at outlook.com

SQL Scripts

Below are some helpful scripts I have built up over the years. The first is an extension of sp_spaceused to provide table level summary.
sp_spaceused2 with table level details (2018-02)

An alternate to the index level space usage query is a system stored procedure, extending sp_helpindex.
sp_helpindex2 ((2018-04-08))
is my version of extended index information. It would be desired if the table and index sp_spaceused extensions could be made into system views, but apparently SQL Server does not allow modifications to system resource database anymore?

partition level view
sp_partitions (2018-02-23)

sp_updatestats2 (2018-04-10)
An alternative to the SQL Server sp_updatestats.
The internal statistics update is based on all rows from a random sample of pages.
There can be adverse effects for indexes in which the lead key is not unique
and may be especially severe if compounded.
See Statistics that need special attention.

sp_updatestats2 does fullscan on indexes excluding identity or single key column unique.

Test version for incremental statistics: sp_updatestats2 (test version)