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.
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 |
|
|
eligazit
Starting Member
14 Posts |
Posted - 2005-04-19 : 02:35:47
|
Thanks its works. |
|
|
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? |
|
|
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 likeSELECT I.rows, O.nameFROM dbo.sysindexes IJOIN sysobjects OON O.ID = I.IDWHERE indid = 1Kristen |
|
|
eligazit
Starting Member
14 Posts |
Posted - 2005-04-19 : 18:17:20
|
Thanks again, this is the exact syntax. |
|
|
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 |
|
|
|
|
|