I have a table in SQL Server 2012. The table has few columns. Now I need to check for which column and what is the DDL script has been executed on this table. Or if it is possible to get what is the latest ALTER
has been executed for this table.
Thanks in advance.
To find the name of the history table you can use the system table sys. tables along with the system function OBJECT_NAME. From sys. tables, you have to use the column history_table_id to get the object_id of the history table for the given current table.
You cannot achieve this if you do not have a historical or archive table that store this data (using a DDL Trigger) or using a source control.
OR
You have to use a third-party log reader (if log is not shrinked) like ApexSQL LOG
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With