22,211
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
select number from master..spt_values where type='p' and number between 10 and 20 order by newid()
number
-----------
15
14
18
12
20
13
10
16
17
11
19
(11 行受影响)
select top 1 abs(checksum(newid()))%10+10 from sysobjects
select top 11 identity(int,10,1) as id into # from syscolumns a
select * from # order by newid()
drop table #
/*
id
-----------
13
20
17
18
16
12
11
19
10
15
14
(所影响的行数为 11 行)
if object_id('[tb]') is not null
drop table [tb]
go
create table [tb]([id] int,[col] int)
declare @i int
set @i=1
while @i<20000
begin
insert tb values(floor(11*rand()+10),@i)
set @i=@i+1
end
select top 100000 id=identity(int,2,1) into # from syscolumns a,syscolumns b,syscolumns c,syscolumns d,syscolumns e
不好意思,太快了select top 100000 id=identity(int,2,1) from syscolumns,syscolumns,syscolumns,syscolumns,syscolumns
--临时表
select top 20000 identity(int,0,1) as id into # from syscolumns a,syscolumns b , syscolumns c
select * from #
drop table #