November 13, 2012 at 9:47 am
Does any one know a simple query that would give following information about all databases on an insance?
1. Database Name
2. Created Date
3. Modified date (if any changes made to any table in a particular db)
4. Size of the DB Name.
5. Database last read (NOTE: i do weekly backups so wanted to make sure i am not pulling backup date instead of read date)
November 14, 2012 at 12:45 am
Hi, try the following query, hope it helps.
SELECT * FROM sys.databases
Regards,
Asa_M
November 14, 2012 at 5:11 am
For a starter in relation to DB_Name, Create date and size the following will work. This looks only at the 1st data file and ignores the log files but can be amended if you have multiple data files by adding the additional file to the in statements
SELECT sd.name, sd.create_date, (sm.size*8)/1024 AS SizeMB from sys.databases sd JOIN
sys.master_files sm on sd.database_id = sm.database_id where sm.file_id IN (1)
November 14, 2012 at 7:37 am
hs24, the SizeMB is the size for what exatly? the whole database?
November 14, 2012 at 8:48 am
The sizeMB is for the size of the data file
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply