当前位置: 代码迷 >> Sql Server >> 程序调用sql触发器有关问题
  详细解决方案

程序调用sql触发器有关问题

热度:86   发布时间:2016-04-27 12:39:05.0
程序调用sql触发器问题
SQL code
-- 自己建了一个触发器,手工输入数据能触发,价格会变成1234create trigger triGAon GatheringVouchDetail    for insertas    declare @id nvarchar(1000)    select @id=fchrGatheringVouchDetailID from inserted    update GatheringVouchDetail set flotMoney=1234 where [email protected]-- 当我开程序选择商品录入商品信息的时候,却没有更改价格的数据-- 后台我跟踪了下,是存在insert的insert bulk GatheringVouchDetail ([fchrGatheringVouchDetailID] UniqueIdentifier, [fchrSettleID] UniqueIdentifier, [fchrGatheringVouchID] UniqueIdentifier, [flotMoney] Decimal(28,6), [ftinOrder] Int, [fchrBankName] NVarChar(100) COLLATE Chinese_PRC_CI_AS, [fchrBankAccNo] NVarChar(50) COLLATE Chinese_PRC_CI_AS, [fchrNotesNo] NVarChar(50) COLLATE Chinese_PRC_CI_AS, [fbitVipNoPoint] Bit, [fbitIsGiftToken] Bit, [flotOverflowMoney] Decimal(28,6), [fbitIsStoredCard] Bit, [fbitBank] Bit)-- 数据的确插入GatheringVouchDetail这张表了,但没有执行我这个触发器-- 各位大牛,这是什么问题?


------解决方案--------------------
那证明触发器还是有问题啊。

create trigger triGA
on GatheringVouchDetail
after insert --试试 
as

------解决方案--------------------
SQL code
create trigger triGAon GatheringVouchDetail    for insertas    update GatheringVouchDetail set flotMoney=1234 from inserted i where  GatheringVouchDetail.fchrGatheringVouchDetailID=i.fchrGatheringVouchDetailID--try
------解决方案--------------------
create trigger triGA
on GatheringVouchDetail
for insert
as
begin
RAISERROR ('Notify||||', 16, 10);
end
go
  相关解决方案