DECLARE @Start INT = 1; --开始
DECLARE @Digits INT = 6; --后几位
DECLARE @prefix VARCHAR(50) = ‘0990‘;--前缀
DECLARE @end INT=500000; --结束
SET @Start = 1
WHILE @Start < @end
BEGIN
INSERT INTO Test
( TId )
VALUES ( @prefix+ REPLICATE(‘0‘,@Digits - DATALENGTH(CAST(@Start AS VARCHAR(50)))) + CAST(@Start as VARCHAR(50)) )
SET @Start = @Start + 1
END
时间: 2024-10-08 13:33:12