Subscribe to Windows IT Pro
January 31, 2006 12:00 AM

Quickly Retrieve a List of Available Media Resources

SQL Server Pro
InstantDoc ID #49251
Rating: (0)
Downloads
49251.zip

The sp_GetAllSQLMediaTypes stored procedure lists the names of all the available media (i.e., drives) and their types (e.g., hard disk, tape, floppy, CD-ROM) on a SQL Server machine. As Listing 1 shows, sp_GetAllSQLMediaTypes uses a relatively unknown extended procedure called xp_availableMedia. After GetAllSQLMediaTypes runs xp_availableMedia, sp_GetAllSQLMediaTypes fills a temporary table with the results. It then decodes the media type values into meaningful terms based on the information under Media Type Constants (SQLDMO_MEDIA_TYPE) in SQL Server Books Online (BOL).

To use sp_GetAllSQLMediaTypes, you run the code

USE master 
GO
EXEC GetAllSQLMediaTypes 

I wrote and tested sp_GetAllSQLMediaTypes on a Windows XP machine running SQL Server 2000 Service Pack 1 (SP1). Figure 1 shows the results when I ran it on my machine.

Editor's Note
Share your SQL Server discoveries, comments, problems, solutions, and experiences with products and reach out to other SQL Server Magazine readers. Email your contributions (400 words or less) to r2r@sqlmag.com. Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $50.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.