insert into a values('002','')
select * from b 

解决方案 »

  1.   

    用exec sp_executesql 
      

  2.   

    insert into a values('002','')
    insert into a
    select * from b 
      

  3.   

    INSERT INTO a
    SELECT '002',column_name FROM b
      

  4.   

    select * from b  ;  insert into a values('002','')
    ----------------^^^分号
      

  5.   

    select * from b    insert into a values('002','')
    insert into a select top 1 '002','' from b
      

  6.   

    if exists (select 1 from b where ....)
    insert into a values('002','')
      

  7.   

    --这样
    if not exists(select * from b)  insert into a values('002','')
      

  8.   

    if exists (select Top 1 * from b where ....) insert into a values('002','')
      

  9.   

    INSERT INTO A(a1,a2,..) SELECT b1,b2,...FROM B a1,a2,...要同b1,b2,...对应!
      

  10.   

    if not exists(insert into a values('002','') then ...
    我想这样