在SELECT上触发触发器 [英] Fire triggers on SELECT

查看:204
本文介绍了在SELECT上触发触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是触发器的新手,从sql server中的数据库表中选择值时需要触发触发器.我曾尝试在插入/更新和删除时触发触发器.选择值时有什么方法可以触发?

I'm new to triggers and I need to fire a trigger when selecting values from a database table in sql server. I have tried firing triggers on insert/update and delete. is there any way to fire trigger when selecting values?

推荐答案

我知道只有两种方法可以做到这一点,而且都不是触发器.

There are only two ways I know that you can do this and neither are trigger.

  1. 您可以使用存储过程来运行查询,并将查询记录到表和其他您想知道的信息中.
  2. 您可以使用SQL Server的审核功能.
  3. li>
  1. You can use a stored procedure to run the query and log the query to a table and other information you'd like to know.
  2. You can use the audit feature of SQL Server.

我从来没有使用过后者,所以我不能说它的易用性.

I've never used the latter, so I can't speak of the ease of use.

这篇关于在SELECT上触发触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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