SQL TIP #1 - How To Determine Size Of The Database

This is one of the interesting questions which you might to know most of the time,

What is the size of my database?

What is the size of a specific table?

And to answer these questions you have the following simple command which you can use to determine the size of the database and also size of the table.

The syntax of the command is very simple which is 

Use databaseName
GO
sp_spaceUsed 
GO

If you see the below snap you will find that by running this simple command we have database size.

So far so good. But what about the table size. So, to determine this we have the following syntax

Which is 

sp_spaceUsed 'tableName'

See below snap to understand it more,

I hope this simple tip might help you determine the space of your database and table.

Thanks 


Similar Articles