SQL 触发器:晚上10点数据库自动统计数据,依据A表的ID,统计B表的Quan
来源:百度知道 编辑:UC知道 时间:2024/06/06 06:15:22
create trigger tg_test002
on test002
for update
as
IF datepart(hour,getdate())>18 then
BEGIN
A.Quan_Sum=(select sum(B.Quan)as Pro_Sum from A where.A.IDA=B.IDB)
END
END IF
on test002
for update
as
IF datepart(hour,getdate())>18 then
BEGIN
A.Quan_Sum=(select sum(B.Quan)as Pro_Sum from A where.A.IDA=B.IDB)
END
END IF
触发器实现不了这个功能,因为触发器只有对表进行insert、updae或delete的时候才会执行,你上述的这个功能根本就未对表进行处理,所以不能出现此功能~!
请问你的是怎么实现的呢,可以分享一下吗