22,300
社区成员




select * from sysobjects where type = 'TR';
exec sp_helptext 'tr_test_update'
create trigger tr_test_update on PURTA
for update
as
if exists(select * from inserted left join PURTB on
inserted.单别=PURTB.单别 and inserted.单号=PURTB.单号 where A='' or B='')
begin
raiserror('“参考单别”或“参考单号”不能为空!',16,1)
rollback
end
select * from sysobjects where type = 'TR';
exec sp_helptext 'tr_test_update'
create trigger tr_test_update on PURTA
for update
as
if exists(select * from inserted left join PURTB on
inserted.单别=PURTB.单别 and inserted.单号=PURTB.单号 where A='' or B='')
begin
raiserror('“参考单别”或“参考单号”不能为空!',16,1)
rollback
end
create trigger tr_test_update on PURTA
for update
as
if update(审核码)--这个就是审核
begin
if exists(select * from inserted left join PURTB on
inserted.单别=PURTB.单别 and inserted.单号=PURTB.单号 where A='' or B='')
begin
raiserror('“参考单别”或“参考单号”不能为空!',16,1)
rollback
end
end
go
[/quote]
已经能达到效果,提示审核失败,
create trigger tr_test_update on PURTA
for update
as
if update(审核码)--这个就是审核
begin
if exists(select * from inserted left join PURTB on
inserted.单别=PURTB.单别 and inserted.单号=PURTB.单号 where A='' or B='')
begin
raiserror('“参考单别”或“参考单号”不能为空!',16,1)
rollback
end
end
go
[/quote]create trigger tr_test_update on PURTA
for update
as
if update(审核码)--这个就是审核
begin
if exists(select * from inserted left join PURTB on
inserted.单别=PURTB.单别 and inserted.单号=PURTB.单号 where A='' or B='')
begin
raiserror('“参考单别”或“参考单号”不能为空!',16,1)
rollback
end
end
go