1. --课件自动编号
declare @pt_OtherCateCode varchar(50)
exec App_s_spGetSequenceNumber 'KJ',1,@pt_OtherCateCode output,0
2.
/*
Func:获得自动编号
CreateDate:20140829
CreateUser:Jesson
*/
Create Proc SdErp_spGetNumberExecute
(
@pi_Action varchar(50);
)
as
declare @po_ProjectNumber varchar(50)
declare @pt_maxval varchar(50)
if(@pi_Action='HZHB')
begin
select @pt_maxval=max(right(PartnerCode,4))+1 from SdErp_Partner
set @po_ProjectNumber='HZHB'+ CONVERT(varchar(12), getdate(),112) + --取秒
(select case
when @pt_maxval is null then '0001' --如果编号为空,则先给出一个值
else @pt_maxval
end
)
select @po_ProjectNumber
end
转载于:https://www.cnblogs.com/howie/p/4999669.html