有如下表
tb_Test
c_No     i_Sum
1234567  20
2345678  30
3456789  10
1111111  100
......将c_No重复i_Sum次。就是要得到
1234567
1234567
1234567
1234567
.......共20行
2345678
2345678
2345678
2345678
......共30行
..........类推请问应该怎能处理?

解决方案 »

  1.   

    create table tb(a varchar(10),b int)
    insert tb select 1234567  ,20
    union all select 2345678  ,30
    union all select 3456789 , 10
    union all select 1111111,  100select top 100 identity(int) id into # from sysobjects,syscolumns
    select a.* from tb a
    inner join # b
    on a.b>=b.id
    drop table tb,#
      

  2.   

    给你写个类似的
    create table t1(id int,num int)
    insert t1 select 1,3 union all
              select 2,2 union all
              select 3,2 create table t2(id int,a1 int)set rowcount 10
    select id=identity(int,1,1) into #T from syscolumns
    set rowcount 0insert t2 select t1.id,#T.id from t1 left join #T on #T.id <= t1.numselect *from t2正在吃饭,就不改了  ^_^