如何创建临时表,把查询结果导入到临时表中?

解决方案 »

  1.   

    select * into #tmp from tb where ...
      

  2.   

    select *
    into #
    from oldtable 
    --or
    create table #()
    insert #
    selec  * 
    from oldtable
      

  3.   

    create table #tb(..)insert into #tb select * from tb1
      

  4.   

    方法一:
    create table tb
    insert into #tmp
    select * from tb where ......
    方法二:
    select * into #tmp from tb where ....
      

  5.   


    --第一种
    create table #temp(col1 int)
    --第二种
    select * into #temp from table1
      

  6.   


    --第一种 表结构已定
    create table #temp(col1 int)insert into #temp
    select * from tablename--第二种  临时表和 结果表一样
    select * into #temp from table1