SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


query to get dbname,totalsize,reservedsize of all databases in sql 2000


query to get dbname,totalsize,reservedsize of all databases in sql 2000

Author
Message
syamala.popuri
syamala.popuri
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 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
tommyh
tommyh
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1804 Visits: 2000
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search