如果将查询结果 保存到数据中 覆盖原有的数据 

解决方案 »

  1.   

    先 select .. .into #临时表, 再从原表删除, 再从临时表插入
      

  2.   

    意思就是把不符合查询结果的删除吧
    --比如你是
    select *  from tb where flag >0
    --覆盖原有tb的数据
    --你可以直接delete from tb  where flag<=0select  *  from tb --就是你需要的flag>0的数据
    --或者入楼上老大说的select *  into #temp  from tb where flag>0delete * from tbinsert into tb select *  from #temp
      

  3.   

    先生成临时表
    select * into #temp from tb
    删除原表
    drop table tb
    插入到新表中
    insert into 新表 select * from #temp