|
|
Suppose you want to track when was the last time a particular SQL Server object (table, view, procedure etc) was modified. To do so, you can make use of the system views - sys.objects and sys.all_objects.
create table test(id int, names varchar(100))
GO
select name, create_date, modify_date
from sys.objects
where name='test'
The above gives you the create_date and modify_date (in this case both will be the same).

Now alter the table to change the width of the column names
alter table test
alter column names varchar(150)
GO
Now execute the same select statement again:

Executing the above statement gives you the create_date and modify_date (in this case modify_date will be greater than the create_date). Whenever there is a column change in the table, the modify_date column gets updated.

Note: You can use sys.all_objects in place of sys.objects too.
Did you like this post?
|
|
|
||
|
|
|
|
|
|
|
subscribe via rss |
|
subscribe via e-mail |
|
|
print this post |
|
follow me on twitter |






comments
0 Responses to "SQL Server: Get Object Last Modified Date"Post a Comment