类似如下的语句,正确的写法是什么?谢谢declare @t table
set t= (select id, name from t2)table初始化

解决方案 »

  1.   

    declare @t table(id int,[name] varchar(100))
    insert into @t select id,[name] from tb
    select * from @t
      

  2.   

    declare @t table(id int,name varchar(10))  --这里insert into @t(id,name)
    select id,name from t2
      

  3.   


    --那就成临时表了,表变量需要声明
    select *
    into #tb
    from tb