declare @a int
set @a=1390100
while @a<=1390800 begin
insert 表 select @a
set @a=@a+1
end
set @a=1390100
while @a<=1390800 begin
insert 表 select @a
set @a=@a+1
end
解决方案 »
- 最近学习到了sql server2005新增的output用法,和大家分享一样
- 怎么把sql server 2000数据库中的一个表的的一列的不为空的行的个数统计出来,并输出到asp+html网站的一个表格里呢?
- 求一个sql语句
- 求简单SQL替换语句。
- 如何将视图结果存在表中
- [在线等]请教一个多表查询语句 关键字:INNER JOIN, SUM, GROUP BY
- 安装sql server 2005
- 数据库备份和还原计划如何制定??
- 未解决的有难度问题
- select语句按某个字段随机排序怎么实现??
- 求一学生奖金发放.....有要求的 sql语句!!!
- 数据记录中"-1.#IND"值是什么意思?请详细说说,谢谢!
declare @end int
set @start = 100
set @end = 800while ( @start <= @end )
begin
insert into t
select '1390' + cast( @start as varchar( 3 ) ) @start = @start + 1
end
declare @t table(id int identity(100,1),c int)set rowcount 701
insert into @t select 1 from sysobjects a,sysobjects b
set rowcount 0insert into @s select rtrim(1390000+id) from @t order by idselect * from @s
select top 701 rowid = identity(int,100,1) into #t from sysobjects a,sysobjects b
select * from #tinsert into @t1 select '1390'+convert(char(3),rowid) from #t
select * from @t1
drop table #t
/*
col
-------
1390100
1390101
1390102
1390103
1390104
1390105
1390106
1390107
1390108
1390109
1390110
1390111
1390112
1390113
1390114
1390115
1390116
1390117
1390118
1390119
1390120
1390121
1390122
1390123
1390124
1390125
1390126
1390127
1390128
1390129
1390130
1390131
1390132
1390133
....
1390800
*/
create table #Num(
hand_num varchar(20) null
)
declare @i int
set @i = 1
while @i <=701
begin
insert into #Num values(1390099+@i)
set @i = @i + 1
end
select * from #Num
drop table #Num