Getting details about all SQL databases with one query

by rahul 11/12/2008 12:41:39 AM

Scenario: You have a SQL Server, and plenty of databases. Time progresses, and you started using another Disk OR Partition. Let's say you want to know how much space is being taken by all the Databases put together. OR better still, you want to get the details of all the Databases at one shot and not via that Right-Click->Properties thingy...

Here is what could help you...


    Go to SQL Query Analyzer window and ensure that Results to Text (CTRL + T) option is selected.

          image 
            
    Type the following in Query window and Execute it...
            select 'sp_helpdb ''' + name + '''' + char(10) + 'go'  from sys.databases

    Here is how my output looks like...
            image
    Copy the selected part as shown above and execute, and you should get the details about all the tables at one shot. Yeah, this is no rocket science, but quite effective at times. Thumbs-up

Cheers, Smile
Rahul


Quote of the day:
An ignorant person is one who doesn't know what you have just found out. - Will Rogers


blog comments powered by Disqus

Comments

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0