ALTER Procedure [dbo].[USP_GETNO]
@NOCode Varchar(20),
@OutNO Varchar(30) OutPut
As
Declare @Basc Int
Declare @HeadData Varchar(20)
Declare @AfterData varchar(20)
Declare @ModifyDate DateTime
Declare @CurMonth Varchar(7)
Declare @Format Varchar(20)
Declare @NO Varchar(30)
Declare @I Int
Declare @CurDate DateTime
Set NoCount ON
Select @CurDate=GetDate()
Select @Basc=(Select BascData From Sys_SysNO Where NOCode=@NOCode)
Select @HeadData=(Select HeadData From Sys_SysNO Where NOCode=@NOCode)
Select @AfterData=(Select AfterData From Sys_SysNO Where NOCode=@NOCode)
Select @ModifyDate=(Select ModifyDate From Sys_SysNO Where NOCode=@NOCode)
Select @CurMonth=(Select CurMonth From Sys_SysNO Where NOCode=@NOCode)
Select @Format=(Select Format From Sys_SysNO Where NOCode=@NOCode)
If (@HeadData Is Not Null) And (LTrim(RTrim(@HeadData))<>'')
Select @NO=@HeadData
Else
Select @NO=''
If (Left(@Format,4)='YYMM') And (Left(@Format,6)<