print right( '0000'+ convert(nvarchar(3),convert(int,right(@GetMaxNo,@typecode))+1),4)
字段获取值:20221206001 ,类型为字符串型。YYYYMMDD+3位流水,需要得到 20221206002。