Home > Database > Mysql Tutorial > body text

如何解决DB2数据迁移中的外键约束问题

WBOY
Release: 2016-06-07 17:12:33
Original
1326 people have browsed it

迁移数据的时候一定遇到过导入导出的外键约束报错问题,外键约束是为了保证数据库的完整性,完整性的英语单词是integrity,所以这

迁移数据的时候一定遇到过导入导出的外键约束报错问题,外键约束是为了保证数据库的完整性,完整性的英语单词是integrity,所以这个临时关闭外键约束让你畅快导入的命令是:

set integrity for table_name off 

set integrity for table_name foreign key immediate unchecked

除了这种方式,,你还可以使用alter语句修改constraint,使它不执行,这样也能达到这个目的:

ALTER TABLE ALTER FOREIGN KEY NOT ENFORCED

数据导入完成后你需要它正常工作,保证数据的完整性:

ALTER TABLE ALTER FOREIGN KEY ENFORCED 

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template