Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

How to get the SQL table size, index size and last user update

08 January,2016 by Tom Collins

Question: How can I get a list of every table in a database, with auxillary information including numbers of rows, data space, index space, percent of database?

I’ve read through the post and sql script on  SQL Index Usage - SQL Server DBA  but it doesn’t include certain information. Do you have a script returning this table detail?

Answer: A colleague of mine offered this script , which returns the sort of table detail you require. He can’t remember who gave him the script, so thank you to the mystery author.

This script includes returning indexes and metadata per index in the tables. It is very useful particularly if you’re reviewing tables within a database.

I manage SQL Server databases and as part of regular maintenance of the databases, thi s is the sort of information to analyse. It’s not unusual to find tables that are now redundant , these can be offered to the owner , who may decide to drop or archive the table.

Download Tablesize_and_last_user_updates

These sort of tactics assist in streamlining the databases. It will be quicker to run maintenance plans and backup.


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to get the SQL table size, index size and last user update


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer