--------------------------开始--------------------------
--开始值
DECLARE @start INT = 1
--结束值
DECLARE @end INT = 1000
--长度
DECLARE @length INT = LEN(@end)
--前缀
DECLARE @prefix VARCHAR(50) = '0990';
--后缀
DECLARE @suffix VARCHAR(50) = '';
------------------------------------------
WHILE @start < @end
BEGIN
INSERT INTO dbo.Scenery
( Name
)
VALUES ( @prefix + REPLICATE('0',
@length
- DATALENGTH(CAST(@start AS VARCHAR(50))))
+ CAST(@start AS VARCHAR(50)) + @suffix
)
SET @start = @start + 1
END
--------------------------结束--------------------------