建立触发器后,不能像表中插入数据,是什么原因
USE [cai2016]
GO
/****** Object: Trigger [dbo].[trigger_yunum] Script Date: 2017/3/29 17:30:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
alter trigger [dbo].[trigger_yunum]
on [dbo].[newmoo_case_cgxd]
for insert
as
BEGIN
DECLARE @id bigint SELECT @id = id FROM INSERTED
DECLARE @purchase_id varchar SELECT @purchase_id = purchase_id FROM INSERTED
DECLARE @slength nvarchar SELECT @slength = slength FROM INSERTED
DECLARE @engname nvarchar SELECT @engname = engname FROM INSERTED
DECLARE @swidth nvarchar SELECT @swidth = swidth FROM INSERTED
DECLARE @kehu_id bigint SELECT @kehu_id = kehu_id FROM INSERTED
DECLARE @caseid bigint select @caseid =caseid FROM INSERTED
DECLARE @productnum int SELECT @productnum = productnum FROM INSERTED
DECLARE @pay numeric SELECT @pay = pay FROM INSERTED
DECLARE @costprice numeric SELECT @costprice = costprice FROM INSERTED
DECLARE @pid_p bigint select @pid_p =pid_p FROM INSERTED
DECLARE @cz int SELECT @cz = cz FROM INSERTED
DECLARE @productRemarks nvarchar SELECT @productremarks = productremarks FROM INSERTED
DECLARE @weight numeric SELECT @weight = weight FROM INSERTED
Update a set a.overnum=(select a.id, a.overnum, a.oknum, a.yunum, b.caseid, b.productnum, b.ischeck, sum(b.productnum) from newmoo_case a, newmoo_case_cgxd b where b.caseid=a.id and b.ischeck=3)
end
请问这个触发器设计的有问题么?
建立之后 表b就不能插入数据了啊
删除触发器后就能恢复正常。