How to determine list of all the databases and size of the database ?

 

Dear All,

Sometimes you require list of all the database and size.

To achieve this we need to write  following script

 

   1:  

   2: SELECT sd.name,Convert(Decimal(10,0),(mf.size /1024)) As size

   3: FROM 

   4: sysdatabases sd

   5: INNER JOIN sys.master_files mf ON mf.database_id = 

   6: sd.dbid

   7:  

   8: AND mf.type = 0 

   9: WHERE sd.Name Not IN ('MASTER','tempdb','Model','MSDB')

 

Hope it will resolve your query. Enjoy 🙂

Rajat Jaiswal

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