餐饮的管理系统 餐饮的管理系统云部署(38)

对相关biǎoxíng触发器相关de修改操作shí触发器自动执xíng 。常yòngshùdecānzhàozhěng性限制级联删除、级联更新等操作deshè置 。以级联更新为例,fēncàidānbiǎozhōngdecàipǐnbiānhào修改shídiǎncàibiǎozhōngdecàipǐnbiānhàoshí更新这样de操作yòng触发器如何shí现:
create trigger upd on cd after update
as
declare @jbh char(5),@xbh char(5)
select @jbh=deleted.cpbh, @xbh= inserted.cpbh
from deleted,inserted where deleted.cpbh=inserted.cpbh
print 'zhǔn备级联更新diǎncàibiǎozhōngdecàipǐnbiānhàoxìn….'
update dc set cpbh=@xbh where cpbh=@jbh
print '已经级联更新lediǎncàibiǎocàipǐnbiānhào为'+ @jbh +'de