DECLARE @max AS INT, @rc AS INT
SET @max = 1000000
SET @rc = 1
INSERT INTO Nums VALUES(1)
WHILE @rc * 2 <= @max
BEGIN
INSERT INTO dbo.Nums SELECT n + @rc FROM dbo.Nums
SET @rc = @rc * 2
END
INSERT INTO dbo.Nums
SELECT n + @rc FROM dbo.Nums WHERE n + @rc <= @max
GO
只能用循环了,以下是php语法for($i=0$i<10001$i++){
INSERT INTO TABLE();//这里式sql语句
}
insert 表(id,部门) select id,case
when id>=1 and id<=1000 then '部门1'
when id>1000 and id<=1000 then '部门2'
...
else then '部门N'
end from 表 where
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)