FOLLOW US

Tuesday, April 3, 2012

Query to find the size of the database and database file


Technique 1:


     EXEC sp_helpdb


Technique 2: For a specific database:
sp_helpdb'adventureworks'



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


Technique 3: be in the context of the database and run sp_spaceused
Gives you the database size and certain more properties of it:


     EXEC sp_spaceused
This is what you get:


Technique 4: use sys.master_files


SELECTDB_NAME(database_id)AS DatabaseName,
Name AS LogicalName,
size*8/1024 Size_in_MB,
max_size
FROM sys.master_files
WHEREDB_NAME(database_id)='AdventureWorks'
GO




If you liked this post, do like us on FaceBook at http://www.facebook.com/pages/BI-Architects/249973345047634?sk=wall

No comments:

Post a Comment