Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

query to get dbname,totalsize,reservedsize of all databases in sql 2000 Expand / Collapse
Author
Message
Posted Tuesday, October 12, 2010 4:15 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, February 4, 2011 1:22 AM
Points: 15, Visits: 42
Hi,

required query for me to work on sql 2000 server is
query to get dbname,totalsize,reservedsize of all databases in sql 2000.
Any body have so or query ples let me know.

Thanks in advance
Syamala
Post #1002653
Posted Tuesday, October 12, 2010 6:00 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Sunday, June 29, 2014 11:26 PM
Points: 1,481, Visits: 1,960
No perfect answer but maybe it can push you in the right direction.

create table #tbl (name varchar(128), s bigint)
declare @db varchar(128)
declare @sql varchar(2048)
select @db = ''

while exists (select Name from master..sysdatabases where name > @db)
begin
select top 1 @db = Name from master..sysdatabases where name > @db order by Name
select @sql = 'insert into #tbl (Name, s) select ''' + @db + ''', sum(size) from ' + @db + '..Sysfiles'
exec(@sql)
end

select * from #tbl
drop table #tbl

/T
Post #1002709
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse