|
我写了一个触发器如下,是当resume表的jlzt like 1111%时,更新其它字段一下,
其它情况更新情况不同,但是检查语法没错误,但是运行时却有问题,帮我看看.
CREATE TRIGGER [upjlzttojl] ON [dbo].[Resume]
FOR UPDATE
AS
begin
if update(jlzt)
begin
declare @jlzt varchar(15)
select @jlzt=jlzt from updated
if @jlzt like '1111111111%'
update resume set zjl=3 from updated where reid=updated.reid
else if @jlzt like '1111%'
update resume set zjl=2 from updated where reid=updated.reid
else if @jlzt like '0000000000%'
update resume set zjl=0 from updated where reid=updated.reid
else
update resume set zjl=1 from updated where reid=updated.reid
end
if update(ejlzt)
begin
declare @ejlzt varchar(15)
select @ejlzt=ejlzt from updated
if @ejlzt like '1111111111%'
update resume set ejl=3 from updated where reid=updated.reid
else if @ejlzt like '1111%'
update resume set ejl=2 from updated where reid=updated.reid
else if @ejlzt like '0000000000%'
update resume set ejl=0 from updated where reid=updated.reid
else
update resume set ejl=1 from updated where reid=updated.reid
end
end |
|