慎用create table as select,一定要注意默认值的问题
来源:互联网 发布:mysql截取字符串函数 编辑:程序博客网 时间:2024/06/10 11:50
再做一些数据迁移时候,很多人会使用create table as select * from table where id=-1的方式来年建立一摸一样的表,但是这样做有个很大的弊端,不能将原表中的default value也一同迁移过来,可以看下面的例子:
第一,新建一个表
-- Create table
create table table01
(
id number(16),
add_date date default sysdate,
status number(1),
entp_code varchar2(200)
)
第二,使用create table table02 as
select * From table01 where id=-1
第三、看看两个表的结构,会发现第二张表的defaule value没有了,如下2图,可以很明显看出来,表02的add_date的默认值得sysdate没有了
table01的表结构
table02的表结构
所以各位在做数据库迁移时候,使用create table as select时候,一定要注意默认值的问题。
0 0
- 慎用create table as select,一定要注意默认值的问题
- 慎用create table as select,一定要注意默认值的问题
- 慎用create table as select,一定要注意默认值的问题
- 慎用create table as select,一定要注意默认值的问题
- 慎用create table as select,一定要注意默认值的问题---大一临时表方法
- Create table as select
- create table as select
- ORACLE CTAS(create table as select)使用注意点
- ORACLE CTAS(create table as select)使用注意点
- oracle create table as select
- Oracle Create Table as Select
- 浅谈create table as select
- create table as select 和 create table 再insert into select 的差异
- create table as 产生的问题
- 复制表的(create table table1 as select * from table2 )问题
- oracle create table xx as select ....CREATE TABLE XXX AS SELECT .... 拷贝表的时候 not null 约束 和check
- create table tb as select 和create table tb like的区别
- Mysql create table tb as select 和create table tb like的区别
- hdu 4930 Fighting the Landlords(模拟)
- springmvc基础知识
- 比AutoMapper轻量快速简洁的实体映射库YeaJur.Mapper
- 什么是装箱和拆箱
- 导入别人的项目报错java.lang.NoClassDefFoundError
- 慎用create table as select,一定要注意默认值的问题
- READING NOTE: Towards Accurate Multi-person Pose Estimation in the Wild
- 兔子-error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址
- adb shell出错“error: unknown host service”
- Nginx安装和反向代理配置
- git常用命令
- C++容器和迭代器(一)——基础概念
- 优秀博客地址
- IDEA生成 jar包文件