Select * Into newtable From oldtable Where 1 = 0  (有些数据库)

解决方案 »

  1.   

    oracle:
    create table newtable as select * from oldtable where rownum<1
    但对于包含blob、long raw等列的表不能用这个方法,可以改用其他工具,例如exp、imp、pb等
      

  2.   

    谢谢上面两位
    如果是VFP呢?
    还有:我只想新表的结构和旧表相同,但表是空的,应该怎么做?
      

  3.   

    你可以建了以后再删嘛,delete from newtable
      

  4.   

    select * into NewTable from OldTable Where 1=0
    这样就可以达到新表的结构和旧表相同,但表是空的目的
      

  5.   

    create table a as select * from b where 1=2不过索引和建表的Storage带不过来 还可以先将以前的表按表结构方式exp出来,然后rename 表1 to 表2,该索引名,然后在将dmp文件imp近来,在该名,就行了。