CREATE TRIGGER [触发器名字] ON dbo.表名
FOR INSERT,update
AS
declare @a number --成绩
declare @id int  --(假设你的表里有一个主键为id)
select @a=成绩,@id=id from inserted  --从将要插入(或更新)数据中读取这个字段的值,id是假设你的表中的主键,如果没有,你可以设一个(可用流水号),这个必须的。
if @a<60  --判断是否及格
update 表名 set 是否补考='是'
else
update 表名 set 是否补考='否'
posted on 2009-12-24 20:54  Myhsg  阅读(148)  评论(0编辑  收藏  举报