我有这样的值'00100-01999' 我需要将这个值增加为'00100,00101,......01999'
我写了这样的脚本
DECLARE @vc_value VARCHAR(20),
@min VARCHAR(10),
@Max VARCHAR(10),
@String VARCHAR(10),
@Start BIGINT,
@End BIGINT
CREATE TABLE #1 (ID VARCHAR(20))
SET @vc_value = '00100-01999'
SET @min = SUBSTRING(@vc_value, 1, CHARINDEX('-', @vc_value) - 1)
SET @Max = SUBSTRING(@vc_value, CHARINDEX('-', @vc_value) + 1, LEN(@vc_value))
SELECT @min,@max
WHILE CAST(@min AS INT) <= CAST(@Max AS INT)
BEGIN
INSERT INTO #1
SELECT CAST(@min AS VARCHAR(10))
SET @min = @min + 1
SELECT @min
END
SELECT * FROM #1
但我得到的结果是 100,101,....1999
我需要像'00100,00101,......01999'