一维扫描码的格式拼接
SUBSTRING(CONVERT(VARCHAR(11),10000000001+ISNULL((SELECT MAX(CONVERT(DECIMAL(10,0),ISNULL(Z.DISCERN_NO,0),0)) FROM DE40T_OTH Z ),0),0),2,10)
DECLARE @IDSEQ NVARCHAR(10)
SET @IDSEQ = (SELECT MAX(IDSEQ)FROM CW_PM271)
IF @IDSEQ IS NULL
BEGIN
SET @IDSEQ = 'SY'+'00000001'
END
ELSE
BEGIN
SET @IDSEQ = 'SY'+ RIGHT('00000000' + RTRIM(CAST(CAST(RIGHT(@IDSEQ, 8) AS INT)+1 AS NVARCHAR)), 8)
END