且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何查看在sql server studio上运行的所有以前的脚本来跟踪?

更新时间:2023-11-30 16:27:46

在数据库中创建一个执行日志表,并在每个脚本中插入此表。插入一条记录作为脚本中的第一条语句,并在脚本的最后一条语句中更新此记录。

记录启动时间,完成时间,成功/失败,脚本名称,帐户运行等等
Create an Execution Log table in the database, and in each script have an insert into this table. Insert one record as the very first statement in the script, and update this record in the very last statement of the script.
Record the time it was started, time finished, success/failure, name of script, account run under, etc.