下面脚本快速生成1百万条记录的表:
set nocount on
use law
go
if object_id('dbo.nums') is not null
drop table dbo.nums
go
create table dbo.nums(n int not null primary key) on newFG
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
select count(*) from dbo.nums
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/37724/viewspace-997822/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/37724/viewspace-997822/