首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

Sql 2000 触发器没被触发,该如何处理

2013-06-25 
Sql 2000 触发器没被触发create trigger trg_bil_changedtl_inserton bil_changedtl for insert,updateass

Sql 2000 触发器没被触发


create trigger trg_bil_changedtl_insert         
on bil_changedtl for insert,update         
as          
set nocount on    
declare @shoptype smallint,@shopmode smallint,@shopcode char(10),@parmvalue smallint      
 
select @shoptype = type,@shopmode = mode,@shopcode = shopcode 
from inf_thisshop          

if @shoptype = 1 or @shopmode = 1

begin           
insert into log_goods_price_change
select shopcode,oldgdsincode,1,billno,oldsaleprice,newsaleprice,null,null,changedate
from inserted,inf_department
where inserted.deptcode = inf_department.deptcode
                and inserted.dealflag = 2
end       
set nocount off
;
create trigger trg_bil_change_shoppricedtl_insert         
on bil_change_shoppricedtl for insert,update         
as          
set nocount on    
declare @shoptype smallint,@shopmode smallint,@shopcode char(10),@parmvalue smallint      
 
select @shoptype = type,@shopmode = mode,@shopcode = shopcode 
from inf_thisshop          

if @shoptype = 1 or @shopmode = 1

begin           
insert into log_goods_price_change
select deptcode,gdsincode,1,billno,oldshopprice,newshopprice,null,null,changedate
                from inserted
                where inserted.dealflag = 2
end       
set nocount off



上面是个触发器

我在自己笔记本生测试一点问题没有(w7系统)

在xp系统上没被触发?? 求解



[解决办法]
不会因为os不同而运行结果不同。 
lz肯定还是数据库中的相关结构或者是数据存在差异。 检查一下看看。 

[解决办法]


是不是被禁用掉了呢 !!
执行一下这句话试试



        ALTER TABLE bil_changedt ENABLE TRIGGER ALL 


[解决办法]
加输出代码 看看是没触发还是执行错了
------解决方案--------------------


在跟踪里面查看一下触发器是否出发。
日志文件中是否存在异常
[解决办法]
from inf_thisshop not where?

热点排行