SQL – Query Database Size
DECLARE @dbsize DEC(15,0)
DECLARE @freespace DEC(15,0)
DECLARE @spaceused DEC(15,0)
 
SELECT @dbsize = SUM(CONVERT(DEC(15),SIZE))
  FROM sems_teas5.dbo.sysfiles
SELECT database_name = 'YOUR_DB_NAME',
       database_size = (@dbsize / 128),
       spaceused=(SELECT (SUM(CONVERT(DEC(15),reserved))/128)
                   FROM sems_teas5..sysindexes
                   WHERE indid in (0, 1, 255))

Comments RSS


Leave a comment:


Blog | Contact | Gallery | Links | Sandbox | Social Networking | Weather | Web Design


Copyright © 1997-2009 KCSH. All rights reserved.