Different methods to know size of the database files

A database basically contains two type of files such as data file and log file. If you want to know the size of these files, you can use any one of the methods shown below

1 Use System stored procedure sp_spaceused

EXEC sp_helpdb tempdb

Look at the second result set and see the column named size
size

2 Use system table sys.sysfiles

select name,filename,size*8 as size_in_kb from tempdb.sys.sysfiles

The result is

size2

3 Use system view sys.database_files

SELECT name, physical_name as filename,size*8 as size_in_mb FROM tempdb.sys.database_files ;

The result is

size2

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s