|
I wrote a trigger as follows, when jlzt like 1111% of resume table, update other fields
In other cases, the update situation is different, but the check syntax is correct, but there is a problem at runtime, help me see.
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 |
|