SQL Server Performance

DB Creation Date

Discussion in 'General Developer Questions' started by vs_siva2000, May 12, 2008.

  1. vs_siva2000 New Member

    I am looking for the database creation date for my database

    I have tried
    select crdate from sysdatabases where name = "Mydatabase" ( from the master database using the SA pasword)

    but the creation date gets changed when i detach and attach "Mydatabase"

    Then i tried

    Select crdate from sysobjects where name = "myTableName"
    I got what i want.

    when i read your article at http://www.sqlmag.com/Authors/AuthorID/61/61.html

    I tried this

    DBCC Traceon (3604)
    DBCC DBINFO( MyDatabase)

    In the output i saw
    dbi_crdate to get the db creation date

    could please help how to get this date alone , my requirment is only the db creation date

    and also noticed that it asks for the SA password
    what happens if i have user say usr1 full control on the Mydatabase and not the other databases such as master

    Is there any mean that i can get the db creation date and also can i run the same command on SQL 2000 and SQL 2005

    Advanced thanks for you help


  2. FrankKalis Moderator

    DBCC DBINFO( MyDatabase) is undocumented and therefore unreliable for use in production code. Also, you would need additional privileges to run this command. An ordinary user in the public role is not allowed to run this command.
    If you need the true creation data, I would probably think of a custom extended property that you add when a new database is created. That value then should be unaffected by any operation on that db unless you change it yourself.

Share This Page