List all the databases on one SQL Server in the order they were created

前端 未结 3 1287
天涯浪人
天涯浪人 2021-02-07 08:53

I have probably in excess of 100 databases on this one SQL Server (2005) instance. I\'d like to list them in order of their create dates, or even better, in the order of the dat

3条回答
  •  醉话见心
    2021-02-07 09:28

    You can easily write this query against the sys.databases catalog view

    SELECT * FROM sys.databases
    ORDER BY create_date 
    

    but unfortunately, there's no equivalent for the "last modification date" that I'm aware of ...

    This should work from any database on that server - doesn't matter which database you're in, those sys catalog views should be accessible from anywhere.

提交回复
热议问题