2 回答
TA贡献1735条经验 获得超5个赞
alter proc check_productstate
@productsId int
as
begin
declare @sales int,
declare @salesvalue int
select productsTypeId,@sales=Sales from [Base_Gx_ProductsInfo]
where productsTypeId=@productsId
select @salesvalue=SaleValue from [@salesvalue ] where '条件'
if @sales < @salesvalue
begin
update Base_Gx_ProductsInfo set Status=3,ProcessStatus=1
Where ProductsId=@ProductsId
if(@@error<>0) goto cleanup
end
else
begin
update Base_Gx_ProductsInfo set Status=1,ProcessStatus=1
Where ProductsId=@ProductsId
if(@@error<>0) goto cleanup
end
if( @@error <> 0 ) goto cleanup
else commit transaction
end
---------------------
cleanup:
rellback transaction
呵呵,乱写一下,不知道对你有没有用。。
- 2 回答
- 0 关注
- 500 浏览
添加回答
举报