简体   繁体   中英

SQL Server: Is it possible to get procedure or table creation and last alter date?

SQL Server: is it possible to get procedure or table creation and last alter date?

If it is then how do to it?

SQL Server 2005

Sure:

SELECT name, create_date, modify_date 
FROM sys.tables

SELECT name, create_date, modify_date 
FROM sys.procedures

The system catalog views in the sys schema are present in SQL Server 2005 and up, and provide a wealth of (metadata) information about the database objects.

Check out the MSDN / SQL Server Books Online docs on Querying the SQL Server System Catalog for a lot more details and information.

If you want to take things to the next level and implement a custom schema change tracking solution you can do so by using DDL Triggers.

Take a look at Using DDL Triggers in SQL Server 2005

It is common to use such techniques in order to record what has changed and to even block/rollback changes of an undesirable nature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM