输入banner图图片脚本导航/分类

sql存储过程输出

create procedure [dbo].[Y_GetICBillNo]
@IsSave smallint,
@FBillType int,
@BillID VARCHAR (50) output
as
declare @BillID2 VARCHAR (50)

--赋值@BillID
select @BillID =isnull(FPreLetter,‘‘) + right(fformat + convert(VARCHAR (20),isnull(FCurNo+1,1) + isnull(FSufLetter,‘‘) ) ,len(fdesc)-CHARINDEX(‘+‘,fdesc) +len(isnull(FSufLetter,‘‘) ) )
,@BillID2= isnull(FPreLetter,‘‘) + ‘+‘ + right(fformat + convert(VARCHAR (20),isnull(FCurNo+1,1) + isnull(FSufLetter,‘‘) ) ,len(fdesc)-CHARINDEX(‘+‘,fdesc) +len(isnull(FSufLetter,‘‘) ) )
from ICBillNo
where FBillId= @FBillType

begin tran
if @IsSave=1
update ICBillNo set FCurNo=FCurNo+1,FDesc=@BillID2 where FBillId = @FBillType

if @@error=0 commit
else
begin
rollback
select @BillID=‘‘
end
return

--返回值

2.调用该存储过程

declare @BillID  varchar(50)

exec  Y_GetICBillNo  12,11,@BillID

select @BillID

sql存储过程输出

标签:har   返回   commit   span   declare   dex   convert   exe   update