2008年11月17日 星期一

[MS SQL2005] How to query table and stored procedure last modify date

In the MS SQL Management Studio. Although I can find the table create date in summary page, but sometimes I need know last modify date ,but i only find create date .

But,we can find so many information in sys.all_object .

You can use this sql statement query table information



select [name],create_date,modify_date FROM sys.all_objects where type_desc = 'USER_TABLE'



You can use this sql statement query stored procedure information



select [name],create_date,modify_date FROM sys.all_objects where type_desc = 'SQL_STORED_PROCEDURE'
and substring([name],1,3) not in ('sp_','dt_','xp_')



Why we need to filter 'sp_,dt_,xp_' ,because they are at beginning of sql server system stored procedure name.

©Yichen

沒有留言: