![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a web-based admin section for a site and I would like to be able to query the SQL Server database size and display it within my admin area. Is there a function or method of doing this? My database is hosted by a third party... I appreciate any tips or advice you can provide! Rob |
#3
| |||
| |||
|
|
"Rob Wahmann" <dotcomstudio (AT) sbcglobal (DOT) net> wrote in message news:bWdVa.27537$BM.8963811 (AT) newssrv26 (DOT) news.prodigy.com... I have a web-based admin section for a site and I would like to be able to query the SQL Server database size and display it within my admin area. Is there a function or method of doing this? My database is hosted by a third party... I appreciate any tips or advice you can provide! Rob Depending on what information you need, sp_helpdb might be good enough: exec sp_helpdb MyDB Simon |
#4
| |||
| |||
|
|
Re: exec sp_helpdb MyDB Thanks, Simon. I've seen a lot of those commands thrown around but how do I actually run that? I'm pretty new to SQL Server and I've never set up a stored procedure or a trigger... I'm doing everything right now with queries and an ODBC connection. These sites are relatively small but I do need to learn this stuff so I can build more robust apps. Thanks! Rob |
#5
| |||
| |||
|
|
"Rob Wahmann" <dotcomstudio (AT) sbcglobal (DOT) net> wrote in message news:ebeVa.27550$BM.8967078 (AT) newssrv26 (DOT) news.prodigy.com... Re: exec sp_helpdb MyDB Thanks, Simon. I've seen a lot of those commands thrown around but how do I actually run that? I'm pretty new to SQL Server and I've never set up a stored procedure or a trigger... I'm doing everything right now with queries and an ODBC connection. These sites are relatively small but I do need to learn this stuff so I can build more robust apps. Thanks! Rob snip Any procedure beginning with sp_ is a system stored procedure - most are in the master database (some are in msdb) but you can execute the ones in master from any database on the server. I don't know much about ODBC, but if you're already passing queries to the server and getting results, then try to just pass the query text "exec sp_helpdb MyDB" (without the quotes, of course), and handle the results like any other query. One thing to be aware of is that stored procedures may return multiple result sets, so you have to parse each result set to get all the information. sp_helpdb returns two result sets. Books Online is an excellent reference for all the system stored procedures - they are all listed under the "System Stored Procedures" topic (at least assuming you have SQL2000 - you didn't mention your version). Simon |
#6
| |||
| |||
|
|
Alrighty then... I've got the sp_helpdb prodecure returning results just fine but it's showing the entire size of the database + log file. Is there a way to specify the data file size only? I appreciate any tips! |
#7
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |