日期:2014-05-18 浏览次数:20534 次
select top 1000 IDENTITY(int,1,1) as id into # from sysobjects a,sysobjects b select 姓名,1 as 数量 into 表2 from 表1 a,# t where a.数量>=t.id drop table #
------解决方案--------------------
Haiwer的好办法,虽然有些局限,但思路不错。赞一个!
------解决方案--------------------
非常感谢!楼上2位。
------解决方案--------------------
select 姓名,1 as 数量 into 表2 from 表1 a,(select t1.id+t2.id+t3.id+t4.id+t5.id+t6.id+t7.id+t8.id+t9.id+t10.id+1 from (select 0 as id union all select 1) t1, (select 0 as id union all select 2) t2, (select 0 as id union all select 4) t3, (select 0 as id union all select 8) t4, (select 0 as id union all select 16) t5, (select 0 as id union all select 32) t6, (select 0 as id union all select 64) t7, (select 0 as id union all select 128) t8, (select 0 as id union all select 256) t9, (select 0 as id union all select 512) t10 ) ) t where a.数量>=t.id