SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 MSDE (2000)
 Finding database size
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

eligazit
Starting Member

Israel
14 Posts

Posted - 04/18/2005 :  05:27:42  Show Profile  Reply with Quote
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

United Kingdom
22415 Posts

Posted - 04/18/2005 :  07:40:02  Show Profile  Reply with Quote
sp_helpdb 'MyDBName'

returns "db_size" (in MB)

Kristen
Go to Top of Page

eligazit
Starting Member

Israel
14 Posts

Posted - 04/19/2005 :  02:35:47  Show Profile  Reply with Quote
Thanks its works.
Go to Top of Page

eligazit
Starting Member

Israel
14 Posts

Posted - 04/19/2005 :  03:03:52  Show Profile  Reply with Quote
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

United Kingdom
22415 Posts

Posted - 04/19/2005 :  08:40:24  Show Profile  Reply with Quote
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

Israel
14 Posts

Posted - 04/19/2005 :  18:17:20  Show Profile  Reply with Quote
Thanks again, this is the exact syntax.
Go to Top of Page

Kristen
Test

United Kingdom
22415 Posts

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

Kristen
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000