110,534
社区成员
发帖
与我相关
我的任务
分享
select max(n),min(n) from # where n between 100 and 10000000
--
----------- -----------
10000000 100
(所影响的行数为 1 行)
drop table #
select identity(int,1,1) as n into # from syscolumns a,syscolumns b
select max(n),min(n) from # where n between 100 and 10000000
drop table #
select identity(int,1,1) as n into # from syscolumns a,syscolumns b
select * from # where n between 100 and 10000000 order by n
结果:
178084 100
select identity(int,1,1) as n into # from syscolumns a,syscolumns b
select * from #
create table tb(n int)
go
declare @i int
declare @n int
select @i=1
select @n=@i
insert into tb values(1)
while @n*2<=2000
begin
insert into tb(n)
select @n+n from tb
select @n=@n*2
end
insert into tb(n)
select @n+n from tb where @n+n<=2000
select * from tb
--drop table tb
这个稍微好点 哈哈