SQL Server – Finding out Database creation time

Finding database creation time is simple if database has not been detached from server. You can find database creation time using below methods.

Using sp_helpdb:

You can find the creation time of database using sp_hepldb system procedure.

EXECsp_helpdb'SqlAndMe'

GO

This will return database creation time along with other details:

Using catalog view sys.databases:

Database creation time is also available in sys.databases catalog view:

SELECTcreate_date

FROMsys.databases

WHEREname ='SqlAndMe'

GO

Result Set:

create_date

2012-11-14 15:19:31.987

(1 row(s) affected)

However, if the database has been detached and reattached to server, the creation time will be changed to attach time. Also, if the database has been restored from a backup after dropping the database creation time will be changed.

Actual creation time of database is stored in the boot page of the database which is retained after restore or detach/attach. This is stored as dbi_crdate.

You can use DBCC PAGE to read creation time of database from boot page: