PB+MS SQL+触发器关闭返回值
作者:互联网
PB+MS SQL+触发器必须注意:
若触发器存在两笔以上的返回值,比如两条update 语句,被误判为数据有改变,存盘不成功。
提示:
Row changed between retrieve and update.
No changes made to database.
所以MS SQL 触发器必须统一处理为:
触发器开始加:
if@@ROWCOUNT=0 Return --提高效能
setnocount on --不返回统计笔数,可减少网络频繁响应,提高效性能;避免误判为数据有改变(sybase不存在此类问题)
…
…
结束加:
setnocount off
例如:
drop trigger delete_rolemenu
go
Create trigger delete_rolemenu On BS_Menu for Delete
As
begin
if @@ROWCOUNT=0 Return --提高效能
set nocount on
Delete FROM BS_RoleMenu Where menu_id in (select menu_id from deleted)
set nocount off
end
标签:触发器,set,nocount,--,PB,MS,SQL 来源: https://blog.csdn.net/tlammon/article/details/110715943