Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 MSDE (2000)
 Finding database size

Author  Topic 

eligazit
Starting Member

14 Posts

Posted - 2005-04-18 : 05:27:42
Hello all.
Is their a way to extract the database size?
I need this to show warning message for user that is reaching the size limits.

I'm using c#.

Thanks.

Eli

Kristen
Test

22859 Posts

Posted - 2005-04-18 : 07:40:02
sp_helpdb 'MyDBName'

returns "db_size" (in MB)

Kristen
Go to Top of Page

eligazit
Starting Member

14 Posts

Posted - 2005-04-19 : 02:35:47
Thanks its works.
Go to Top of Page

eligazit
Starting Member

14 Posts

Posted - 2005-04-19 : 03:03:52
Another one for you...
Counting number of lines in the tables of the db,
the 'selecet count(id) from table';
takes to long for large tables, is their a way to extract the data from some sort of meta data instead?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-04-19 : 08:40:24
If you are not too worried about an exact count you can get this information by a query on the system tables (and you can even "freshen" that information before you start). Can't remember exactly which table, probably sysindexes - I expect its something like

SELECT I.rows, O.name
FROM dbo.sysindexes I
JOIN sysobjects O
ON O.ID = I.ID
WHERE indid = 1

Kristen
Go to Top of Page

eligazit
Starting Member

14 Posts

Posted - 2005-04-19 : 18:17:20
Thanks again, this is the exact syntax.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-04-20 : 07:40:53
DBCC UPDATEUSAGE is the command I was trying to remember [to freshen up the numbers]

Kristen
Go to Top of Page
   

- Advertisement -