Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

need script Expand / Collapse
Author
Message
Posted Thursday, November 15, 2012 9:51 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 14, 2014 1:36 AM
Points: 241, Visits: 1,196
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..
Post #1385256
Posted Thursday, November 15, 2012 10:03 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 8, 2014 6:13 AM
Points: 1,694, Visits: 19,550
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



____________________________________________________

How to get the best help on a forum

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

Never approach a goat from the front, a horse from the rear, or a fool from any direction.
Post #1385259
Posted Thursday, November 15, 2012 10:08 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 14, 2014 1:36 AM
Points: 241, Visits: 1,196
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.
Post #1385261
Posted Thursday, November 15, 2012 1:26 PM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Wednesday, August 13, 2014 12:03 PM
Points: 1,480, Visits: 1,028
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.

Post #1385340
Posted Thursday, November 15, 2012 8:42 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 7:59 PM
Points: 3,631, Visits: 5,280
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!

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?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1385437
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse