Table A (RoomId,CurrentPeoNum)里的数据如下:
1   1
2    2 
3    3
我想把这个表的结构附给 @Table B
把Table A 的数据改成
1   0
2   0
3   0
附给@Table B有直接这样的写法吗?
先在这儿谢谢大家了!

解决方案 »

  1.   

    create table a(RoomId int,CurrentPeoNum int)
    insert into a select 1,1
    union all select 2,2 
    union all select 3,3declare @t table(RoomId int,CurrentPeoNum int)
    insert into @t select RoomId,0 as CurrentPeoNum from aselect * from @tdrop table a--这样?
      

  2.   

    我 Table A 里的字段很多,我想
    Delcare @t Table()"@t不申明它有那些字段"
    让后直接把 Table A 里的字段和修改后的数据附给 @t
    这样行吗?
      

  3.   

    那样写好像不行的。如果想用select ... into的话,只能into到表里,临时表或者固定表好像不能into到表变量