Re: NEED Query to Find out all Databases sizes

From: Bill (someone_at_somewhere.com)
Date: 01/07/05


Date: Fri, 7 Jan 2005 13:15:54 -0800

I thought CalcSpace was a cool proc, so just for kicks, I thought I would
try it on an existing table.

The table has 7million rows and currently consumes (with indexes) 4.5gb.
The script CalcSpace estimated it would need 510mb... I didn't
investigate why this returned such a low number, or why my table is
consuming such a high number (when compared to the estimate)

Here's another method that might work for you. It uses 2 existing system
procedures. It's a little backwards, converting the strings to int's, but
it works.

Create table #tblSize (name sysname,rows int,reserved varchar(10),data
varchar(10),idx varchar(10),used varchar(10))

insert into #tblSize EXEC sp_MSforeachtable @command1='sp_spaceused ''?'''
-- select * from #tblSize order by rows desc

select sum(cast(substring(reserved,1,charindex('KB',data,1)-1) as
int) ),sum(cast(substring(data,1,charindex('KB',data,1)-1) as int) +
cast(substring(idx,1,charindex('KB',idx,1)-1) as int) ) as used
from #tblSize

Bill

"rb" <srbssr@yahoo.com> wrote in message
news:eswxO7D9EHA.368@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I want to find out the SQL databases total size in SQL 2000 server, We
> have
> around 55 databases on the server. Can anobody have the query or Stored
> proc
> to find out the total space used in the server. Thanks
> RB
>
>
>
>



Relevant Pages

  • Re: insert output of stored procedure
    ... > every database on the server. ... > Here's the output of the stored proc.. ... Create a tmp table in stored procedure and use the insert ... ... c3 int, ...
    (microsoft.public.sqlserver.programming)
  • SSPI Kerberos for delegation
    ... security context created in server to connect back and authenticate to ... DWORD bufsiz = sizeof buf; ... int n = ib.cbBuffer; ... // wserr() displays winsock errors and aborts. ...
    (microsoft.public.win32.programmer.kernel)
  • SSPI delegation using kerberos
    ... security context created in server to connect back and authenticate to ... DWORD bufsiz = sizeof buf; ... int n = ib.cbBuffer; ... // wserr() displays winsock errors and aborts. ...
    (microsoft.public.platformsdk.security)
  • SSPI Kerberos for delegation
    ... security context created in server to connect back and authenticate to ... DWORD bufsiz = sizeof buf; ... int n = ib.cbBuffer; ... // wserr() displays winsock errors and aborts. ...
    (microsoft.public.platformsdk.security)
  • SSPI Kerberos for delegation
    ... security context created in server to connect back and authenticate to ... DWORD bufsiz = sizeof buf; ... int n = ib.cbBuffer; ... // wserr() displays winsock errors and aborts. ...
    (microsoft.public.security)

Quantcast