Get files (MDF/LDF) information of all databases – TIP #6

To get file (MDF/LDF) information we can write following query

GO
EXEC sp_MSforeachdb ‘USE ?  Execute sp_helpFile’

GO

Or we can write following command
Go
EXEC sp_MSforeachdb ‘USE ? SELECT ”?”, SF.filename, SF.size FROM sys.sysfiles SF’
Go


Or we can write following command
GO

SELECT Name,Physical_name As current_file_Location
From sys.master_Files

Go

Enjoy !!!

Leave a Reply

Your email address will not be published. Required fields are marked *