存储过程参数值记录 [英] stored procedure parameter values logging

查看:57
本文介绍了存储过程参数值记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检查SQL Server 2008 R2中何时以及使用什么参数值执行存储过程?

Is there a way to check when and with what parameter values a stored procedure has been executed in SQL Server 2008 R2?

推荐答案

正如usr所说,根本没有办法做到这一点,但是您可以将其作为解决方法,就像我在我的项目中所做的那样.

As usr said there is no way to do this at all, but you can do this as workaround, which I did in my projects.

创建一个日志表,并在每个过程中实现一个 INSERT INTO log_table 语句,您可以在其中插入带有 GetDate(),过程名称和登录用户的时间.您可以在此表中查找信息.

Create a log table and implement in each procedure a INSERT INTO log_table statement where you insert time with GetDate(), procedure name and logged user. This table you can seek for your informations then.

这肯定只能在将来使用,如果您要寻找旧用途",则不会.

This for sure only works for the future and not if you want to look for "old-use".

这篇关于存储过程参数值记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆