DB2 Load import auto-increment field data

Source: Internet
Author: User

DB2 Load imports auto-increment field data [SQL] when creating a table, the primary keys of some tables are set to auto-increment, which makes it much easier to insert, modify, and delete data in the table, however, once the primary key of the table is used as the foreign key of other tables, Data Mismatch may occur during data migration, how can we solve the data matching problem between auto-increment fields and data files. After in-depth research on load, we found that there are three ways for load to import auto-incremental data: IDENTITYIGNOR, IDENTITYMISSING, and IDENTITYOVERRIDE. After the actual test, for IDENTITYIGNOR and IDENTITYMISSING, the auto-incrementing fields are accumulated by counter; For IDENTITYOVERRIDE, the auto-incrementing fields are imported into the table according to the data in the data file. CREATE a TABLE: [SQL] CREATE TABLE AAD (A_1 INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), A_2 VARCHAR (50 )); data File Content (e: \ load.txt): [SQL] 2, "22" 3, "33" Import command: [SQL] LOAD CLIENT FROM 'e: \ LOAD. TXT 'of del modified by identityoverride replace into aad; after IDENTITYOVERRIDE is added, Load will fill the values in the data file INTO the auto-increment field OF the table.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.