码迷,mamicode.com
首页 > 数据库 > 详细

标准简单SP模板(sql server)

时间:2014-12-31 17:52:13      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:


CREATE
Procedure eSP_ChangeStart --eSP_ChangeStart 64 @ID int, @RetVal Int = 0 Output As Declare @Badge varchar(10), @ID_Max int Begin Select @Badge = Badge From eChange_Register Where [ID] = @ID --该登记记录是否确认 IF Not Exists(Select 1 From eChange_Register Where ID = @ID and IsNull(Initialized,0) = 1) Begin Set @RetVal = 911005 Return @RetVal End Begin Transaction Update a Set a.DepID = b.DepID From Employee a,eChange_Register b Where a.Badge = b.Badge IF @Type=2 Begin Set @RetVal = 911014 Commit Transaction Return @RetVal End IF @Type=1 Begin Set @RetVal = 911091 Commit Transaction Return @RetVal End

 

标准简单SP模板(sql server)

标签:

原文地址:http://www.cnblogs.com/lijy/p/4195982.html

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