THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Tibor Karaszi

Util procedure to show database size

This blog has moved! You can find this content at the following new location:

Published Tuesday, December 29, 2009 2:17 PM by TiborKaraszi



Uri Dimant said:

Hi Tibor

I would add that those numbers are in MB/KB/GB... and /or perhaps the percent usage % or data and log files, what do you think?  

December 29, 2009 7:46 AM

TiborKaraszi said:

Hi Uri,

I had that originally (MB), but decided to remove it to keep the result as slim as possible... :-)

December 30, 2009 2:50 AM

csm said:

Hi Tibor,

there's an error on the definition for #dbcc_sqlperf_logspace table. The datatype for database_name column must be sysname (or something similar), not varchar(32).

Anyway, thanks for the script

January 13, 2010 7:33 AM

TiborKaraszi said:

Hi csm,

That type (varchar(32) is actually deliberate. It was there for tools which doesn't adjust width according to data size. I.e., so we don't have to scroll that much side-ways when reading the result. I think it had to do with 2000 tool (the proc is supposed to be runnable on 2000), but exact details escapes me at the moment.

Sysname would be the type to use if you don't want to truncate long db name - that is correct. :-)

January 13, 2010 11:15 AM

csm said:

But with 32 characters only, the procedure raise an exception (i.e., the AdminContent database in a Sharepoint implementation)

January 18, 2010 3:53 AM

TiborKaraszi said:

You are absolutely right. I guess I only tested it with db names shorter than 32, in order for the tool to not have a too wide column. I now tested it with a long db name and I get the same truncation messaged. I fixed that datatype, changed it to sysname. The "right" way to cut down the length would have been to use CAST or CONVERT on the final select instead of having a smaller type in the input table...

January 19, 2010 11:29 AM

Nemisa said:

July 3, 2018 4:00 AM
New Comments to this post are disabled
Privacy Statement