我想把sql查询结果形成一个新的表格,例如Income,并存在SQLSERVER数据库里,即在SQLSERVER数据库里能看到Income表格,应该怎么写SQL语句?在线等!

解决方案 »

  1.   

    select * into Income from tb where ...
      

  2.   

    select * into 表2 from 表1
      

  3.   

    select into tb from sql查询
      

  4.   

    我刚才试了,是不是那个新表格Income必须为不存在的表格,如果存在,就存不进去,是不是这样? 如果是这样,应该怎么办?马上给分!
      

  5.   

    if object_id('Income') is not null drop table Income
    select * into Income from tb where ...
      

  6.   

    把表格例如Income删除的SQL语句怎么写?不是删除表格中的记录,而是删除整个表格。
      

  7.   

    存在就存不下,存在就用insert into t select * from t1
      

  8.   


    表格Income 里的内容是适时更新的,而不是说不存在就写入查询结果,存在就不写入。我需要适时的把查询结果写入到Income里面。
      

  9.   

    drop table t
    这是什么问题啊?
      

  10.   


    if object_id('Income') is null 
    select * into Income from tb where ...
    else 
    insert Income select * from tb where ...
      

  11.   

    if object_id('Income') is null 
    select * into Income from tb where ...
    else 
    insert Income select * from tb where ...