473,750 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query/read database size?

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
Jul 20 '05 #1
5 33638
"Rob Wahmann" <do**********@s bcglobal.net> wrote in message
news:bW******** ************@ne wssrv26.news.pr odigy.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
Jul 20 '05 #2
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

"Simon Hayes" <sq*@hayes.ch > wrote in message
news:3f******** **@news.bluewin .ch...
"Rob Wahmann" <do**********@s bcglobal.net> wrote in message
news:bW******** ************@ne wssrv26.news.pr odigy.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

Jul 20 '05 #3
"Rob Wahmann" <do**********@s bcglobal.net> wrote in message
news:eb******** ************@ne wssrv26.news.pr odigy.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
Jul 20 '05 #4
Thanks again! I'm going to toy around with how to call the stored proc.

Regards,

Rob

"Simon Hayes" <sq*@hayes.ch > wrote in message
news:3f******** @news.bluewin.c h...
"Rob Wahmann" <do**********@s bcglobal.net> wrote in message
news:eb******** ************@ne wssrv26.news.pr odigy.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

Jul 20 '05 #5
Rob Wahmann (do**********@s bcglobal.net) writes:
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!


If you specify a database name, you get two result sets, whereof the
second gives you sizes per file. You can also use sp_helpfile to get that
second result set only.

See further in Books Online. (Which you may not have installed, but see
my signature.)

--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2819
by: Wm | last post by:
I have a query that I expect to return 3 or 4 entries -- but I seem to be getting only the most recent entry, repeated 4 times. What am I doing wrong here? $query="SELECT artistID,email,city,state,country from artists WHERE email='$email'"; $result=mysql_query($query) or die(mysql_error("Could not execute query.")); if (mysql_num_rows($result) > 0){ $alreadylisted = "1";
11
3763
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET actiavted Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
3
1954
by: Nick Truscott | last post by:
<? // scoreinput.php - input a match score when match selected from list ?> <html> <head> <basefont face="Verdana"> </head> <body>
3
5394
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
11
2138
by: 73blazer | last post by:
We are migrating a customer from Version 7.1 FP3, to Version 8.2 (8.1 FP8). For the most part, things are faster, but there is one query that is much much slower, and it is a query that is used all the time. select ATTR1,ATTR2,ATTR3,ATTR4 from physical.part_list where S_PART_NUMBER like '%KJS%' The widlcard before and after seems to be hosing it, but for this particular piece of the application, this type of query is neccessary.
0
1324
by: quang | last post by:
I have a subform within my results form that I use to display the results of my queries. Here is the problem: once the query has run and its results are displayed in my subform - if you make any changes to the information that is being displayed (changing the size of the columns that are displayed within the subform or sorting the info displayed in the subform), the query that produced the results has its SQL code erased. Here is my...
3
1962
by: cover | last post by:
I have a table with 50 fields that receive input depending on whether that input came in from a 'shaker' form or a 'conveyor' form. Input from the 'conveyor' form might populate 25 fields while input from the 'shaker' form will populate another 20-25 fields but not the same fields (however there are about 10 common fields to both). I'd thought about using two tables (one for 'conveyor' and the other for 'shaker') but thought I'd try just...
5
2514
by: Sam | last post by:
Hi, I have one table like : MyTable {field1, field2, startdate, enddate} I want to have the count of field1 between startdate and enddate, and the count of field2 where field2 = 1 between startdate and enddate, all in the same query.
6
1439
by: Ashlewis | last post by:
Im currently using a string to store my query in VB. It seems to work perfectly fine for short queries. But as my queries become longer and longer, this method just doesnt seem to work. Im using an access database and when i run my SQL queries in that they work fine its just when i transfer them to the vb code they seem to cause errors. So is there a way to call saved access queries in vb without actually putting the query string in the...
4
4586
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9396
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.