Hi All,

Query to find the size of the database and database file is a simple and most common requirement. There are many ways & techniques to do this. Here are ‘just’ some of them:

Technique 1:

Gives you the database size and certain more properties of it:

1_SQL_Server_Query_to_find_the_size_of_the_database_and_database_file

Technique 2: For a specific database:

And you get the following output: (this one gives you the database and data file information for a specific database)

2_SQL_Server_Query_to_find_the_size_of_the_database_and_database_file

Technique 3: be in the context of the database and run sp_spaceused

This is what you get:

3_SQL_Server_Query_to_find_the_size_of_the_database_and_database_file

Technique 4: use sys.master_files

4_SQL_Server_Query_to_find_the_size_of_the_database_and_database_file

HTH !

If there are more ways, do post a comment, would like to learn more. Thanks !

 

Regards

Rahul Sharma

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook