SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Quickly Viewing Available Space

By Boris Baliner, 2006/06/06

Total article views: 9016 | Views in the last 30 days: 18

View Available Space in SQL Server 2000 databases using SQL Server 2005 Management Studio.

Introduction

In March I wrote an article entitled “SQL 2000 to SQL 2005: Where have all the old features gone?”, that dealt with accessing SQL Server 2000 with SQL 2005 tools. Initial idea was that many DBAs are probably using such setup to get accustomed to the new tools, although their employer has not made the move to the SQL Server 2005 yet.

In March article I forgot to mention what I now consider to be an important addendum: how to quickly view Available Space in the files of any given database.

Taskpad functionality

Basically we want to be able to see the free space left in database files, and if you are not connecting to SQL Server 2005 you are not enjoying the latest/greatest colorful Reports in the Summary tab. Oh No, life is worthless, you say…but wait, don’t jump off the cliff yet, because here comes the solution. Simply run the following code in the context of your database:

CREATE PROCEDURE dbo.usp_ShowAvailableSpace 
AS

SELECT name AS NameOfFile,
  size/128.0 -CAST(FILEPROPERTY(name, 'SpaceUsed' )AS int)/128.0 AS AvailableSpaceInMB
 FROM dbo.SYSFILES
GO

Then execute:

EXEC usp_ShowAvailableSpace

You should get something like this:

If you track what Taskpad does, it does precisely that, except that it rounds it off to the hundredth of a megabyte. If you really what the same functionality as Taskpad, just run the following code:

Summary

This is a quick little tool get back what Taskpad offers to Enterprise Manager users. So, until you convert all your servers to SQL 2005 this may prove helpful, hopefully.

By Boris Baliner, 2006/06/06

Total article views: 9016 | Views in the last 30 days: 18
Your response
 
 
Related Articles
SCRIPT

QA-Taskpad

Script to show the Database information similar to what is shown in EM Taskpad

FORUM

Doesn't look like Taskpad is coming back

I don't see Summary of local taskpad

FORUM

Sql 2000, Database don't have available space

Sql 2000, Database don't have avialable space

ARTICLE

Managing Disk Space

How often do you worry about your database size and free space? Steve Jones asks how you administer ...

ARTICLE

Monitoring Drive and Database Free Space

SQL Server will autogrow your databases as they run out of space. But the process doesn't manage spa...

Tags
 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com