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 關注
- 519 瀏覽
添加回答
舉報