select top 0 * into 新表 from 旧表

select * into 新表 from 旧表 where 1=2

解决方案 »

  1.   

    select * into [200309] from [200308] where 1=0
      

  2.   

    select * into [200309] from [200308] where 1=0
      

  3.   

    select * into 新表名 from 表1 where 1=2
      

  4.   

    select * into [200309] from [200308] where 1=0
      

  5.   

    select top 0 * into 新表 from 旧表还有就是用DTS
      

  6.   

    declare @ym char(6)
    set @ym = select convert(char(6),getdate(),112) ----200309
    exec('Select * into ' + @ym + ' from 上月表 ')
      

  7.   

    select * into 新表名 from 表1 where 1=2
    select top 0 * into 新表名 from 表1 
    还有dts都可以
      

  8.   

    创建该月报表前,我要先判断是否存在该月报表,如果已有,刚提示已经生成!
    是否覆盖,如果覆盖的话,刚应该删除该数据表,重新生成之。
    请问:
    1、如何判断该表是否存在
    2、用vb.net语言怎么实现?
      

  9.   

    具体语言不清楚,结构应该是这样的吧。
    if exists(select 1 from sysobjects where name='表名' and type='U')
       提示已经存在,是否覆盖
    end if
    if 覆盖
       drop 表名
       select * from 旧表名 into 新表名 where 一个不存在的条件
    end if