码迷,mamicode.com
首页 > 其他好文 > 详细

存储过程删除举例

时间:2014-05-08 18:46:50      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:des   int   c   2014   数据   set   

USE [NLISSST]
GO
/****** Object: StoredProcedure [SST].[sp_ArbitrationDeleteByID] Script Date: 05/08/2014 10:26:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,高明胜>
-- Create date: <Create Date,,2014-3-11>
-- Description: <Description,,根据ID删除>
-- =============================================
ALTER PROCEDURE [SST].[sp_ArbitrationDeleteByID]
-- Add the parameters for the stored procedure here
@Result int output,--输出结果参数
@ArbitrationID bigint
as
Set @Result=0
Declare @Error int
Set @Error=0
If Exists(Select * From SST.tbArbitration Where ArbitrationID=@ArbitrationID)--存在该项
Begin
if Exists(Select * From SST.tbArbitration Where ArbitrationID=@ArbitrationID and ArbitrationStatus=1)
Begin
Set @Result=2--该数据已仲裁,不允许删除!
End
else
begin
Delete From SST.tbArbitration Where ArbitrationID=@ArbitrationID--删除指定编号的仲裁信息
Set @Error=@Error+@@Error--累加错误数量
if(@Error=0)
Begin
Set @Result=1--成功
End
Else
Begin
Set @Result=0--失败
End
end
End
Else
Begin
Set @Result= -1--没有该数据记录
End

存储过程删除举例,布布扣,bubuko.com

存储过程删除举例

标签:des   int   c   2014   数据   set   

原文地址:http://www.cnblogs.com/eric-gms/p/3715592.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!