June 2, 2011 at 8:56 am
Hi,
I need to know the total space used by a database..
How do i insert the results of 'EXEC SP_SPACEUSED' into a table, since it results in two tables?
Thanks.
June 2, 2011 at 10:32 am
You'll be better off writing your own SELECT statements against the DMVs to get only the information you really want. Here is a good place to start:
USE master
GO
EXEC sys.sp_helptext
@objname = N'sp_spaceused'
GO
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
June 2, 2011 at 10:53 am
Thanks for the tip! 😉
June 2, 2011 at 4:48 pm
You can also go after the data files, summing the number of 8K pages used and converting to your unit of choice (MB in this example):
select sum(fileproperty(df.name,'SpaceUsed'))*8./1024.0 as 'Space Used [MB]'
from sys.database_files df where [type]= 0
June 3, 2011 at 2:43 am
Thanks! 🙂
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply