触发器的最简单问题! 求助!在线等待!
日期:2006-04-24 荐:
触发器的最简单问题! 求助!在线等待!有一张StandardCode 表,有一字段名为Code.当删除StandardCode表中多条记录时,先检查要删除行数,若是多条记录则返回错误信息;我写了代码如下,可是执行后不对,请大家帮忙看看,为什么?谢先!CREATE TRIGGER DeleteCode ON [dbo].[StandardCode] FOR DELETE AS if (select count(s.Code) from StandardCode s,deleted d where s.Code=d.Code)>1beginraiserror('警告!删除记录有多条!',16,1)rollback transactionendCREATE TRIGGER DeleteCode ON [dbo].[StandardCode] FOR DELETE AS if (select count(*) from deleted )>1beginraiserror('警告!删除记录有多条!',16,1)rollback transactionend谢谢paoluo(一天到晚游泳的鱼)但为什么我的就不行呢???
标签: