insert tablename
select * from tablename --1insert tablename
select * from tablename --2insert tablename
select * from tablename --4insert tablename
select top 2 * from tablename --2
select * from tablename --1insert tablename
select * from tablename --2insert tablename
select * from tablename --4insert tablename
select top 2 * from tablename --2
解决方案 »
- SQL2005 还是 SQL2008
- varchar 的如何分组合并
- 用cast将varchar类型的字段值转成int, 但表里的数据不是数值是会出错
- SQL Server 2005安装成功却不会用!!!!!!!!
- 根据一个人的出生日期和今天的日期计算他最近的生日。(内有书中参考答案)
- 这条查询语句怎么写
- 请教一个思路,确定某工序已完工,从流程上讲,应该有专人确认呀,还是能过产量来确定其已完工
- Sql时间差问题,如何算出同今天比相差几年几月几天?
- 求一条SQL语句!有难度!
- 请问各位高手知不知怎样把在NOVELL网络DOS平台上的DBASE III 数据库里的数据传送到 WINNT平台上的SQLSERVER 或 ACCESS 数据库?也就是说在
- 请问大侠关于text,ntext,image数据类型的问题
- 动态sql 在线等
set @n=1
while @n<5 --完成添加 2的4次方过相同记录
begin
Insert tablename
Select * from tablename set @n=@n+1
end
select @aa=9
while @aa
begin
insert into tablename select top 1 * from tablename
select @aa=@aa-1
end
不过要注意主键的问题
select top 29 a.* from tablename a,sysobjects,sysobjects
set @n=1
while @n<30 --在这里设置一下数就可以了
begin
Insert tb
Select top 1 * from tb
set @n=@n+1
end
create table tb (i int)
insert tb values (2)select 原始记录数=count(*) from tbDeclare @n int
set @n=1
while @n<30 --完成添加 2的4次方过相同记录
begin
Insert tb
Select top 1 * from tb
set @n=@n+1
endselect 总记录=count(*),添加的记录条数=count(*)-1 from tbdrop table tb
/*
结果原始记录数
-----------
1总记录 添加的记录条数
----------- -----------
30 29*/
@n int
set @n=0
while @n<5
begin
@n=@n+1
insert tablename
select top 1 * from tablename
end
@n int
set @n=0
while @n<5
begin
set @n=@n+1
insert tablename
select top 1 * from tablename
end
select * from tablename