在查询分析器里可以,在程序运行不行

shornad 2007-01-24 04:36:44
CREATE TRIGGER ICStockBill_transfer ON [dbo].[ICStockBill]
FOR UPDATE
AS

--审核时自动生成调拨单
declare @FOldStatus int ,@fstatus int,@finterid int

select @FOldStatus=fstatus,@finterid=finterid from deleted--修改前
select @fstatus=fstatus from inserted --修改后

if @FOldStatus<>@fstatus--如果修改前后发生变化
begin
if @FOldStatus=0 --修改改无数据为审核 ,修改前有数据为反审核
begin
--审核时 如有定义不合单据
select @finterid=finterid from deleted--修改前
if exists(select fentryselfa0235 from icstockbill a,icstockbillentry b where a.finterid=b.finterid and b.fentryselfa0235='FFF' and a.finterid=@finterid)
exec kd_InsertTransfer @finterid
end
else
begin
--反审核时
if exists(select finterid from icstockbillentry where finterid =@finterid and finterid*1000+Fentryid in
(select fentryselfd0127*1000+fentryselfd0128 from icstockbill a,icstockbillentry b where a.finterid=b.finterid and a.ftrantype=41))
BEGIN
RAISERROR('已生成调拨单,反审核前先删除此单!',18,18)
return
END

end
end


--问题
不执行RAISERROR('已生成调拨单,反审核前先删除此单!',18,18)
...全文
198 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shornad 2007-01-25
  • 打赏
  • 举报
回复
谢谢
xiaoxiao8310 2007-01-24
  • 打赏
  • 举报
回复
参考http://community.csdn.net/Expert/topic/4927/4927766.xml?temp=.2435877
xiaoxiao8310 2007-01-24
  • 打赏
  • 举报
回复
但好象不好做到
xiaoxiao8310 2007-01-24
  • 打赏
  • 举报
回复
个人认为
你的问题改成:
在应用程序中怎么提取数据库中的RAISERROR错误消息比较直观

27,580

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧