SQL复制表的定义和数据

复制表的定义和数据

create table rep_robot_eqp as select * from rep_robot

先复制表的定义,再插入数据

create table rep_robot_eqp as select * from rep_robot where 1=2

先复制表的部分字段定义,再插入数据

create table rep_robot_eqp as (select a.rbtid,a.hour1,a.lots,a.repdate from rep_robot a where 1=2 )

 

注:复制的表不包含默认值等约束信息,使用这种方式复制表后,需要重新建立默认值及索引和约束条件等信息。

 

posted @ 2020-10-16 10:19  bellin124  阅读(113)  评论(0编辑  收藏  举报