need script

  • Hi Team,

    I m looking out put like below

    Database Name Mdf file size Ldf File size current size of the database

    requesting to you guys please help me with exact script its really helpful to me.

    Thanks in advance..

  • Something like this?

    SELECT DB_NAME(database_id) AS DatabaseName,

    SUM(CASE WHEN type=0 THEN size ELSE 0 END) AS MdfSize,

    SUM(CASE WHEN type=1 THEN size ELSE 0 END) AS LdfSize

    FROM sys.master_files

    GROUP BY database_id

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • Hi

    thanks for your reply..

    but i m getting

    database name mdfsize ldf size but i need current size of the database also could you please help me on this.

  • Wouldnt the size of the database be the MDF size + the LDF size?

    No one minds helping, but if you want us to do your job for you, I'm sure someone is available for hire.

  • Ray M (11/15/2012)


    Wouldnt the size of the database be the MDF size + the LDF size?

    No one minds helping, but if you want us to do your job for you, I'm sure someone is available for hire.

    +1

    I'm available.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply