Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9176739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:10:35+00:00 2026-06-17T17:10:35+00:00

I have two tables in two different databases with same structure. I am exporting

  • 0

I have two tables in two different databases with same structure.

I am exporting one table into a .dat file and then importing it to other table using db2 import command:

import from $TEMP_DIR/TO_IMPORT.dat of del modified by dateformat=\"YYYY-MM-DD\" timeformat=\"HH:MM:SS\" timestampformat=\"YYYY-MM-DD HH:MM:SS.UUU\" chardel0x01 coldel|  COMMITCOUNT 1000 messages $LOG_DIR/to_import.log insert into MY_SCHEMA.MY_TABLE

A row in TO_IMPORT.dat is as below:

col1_val|col2_val|col3_val|col4_val|col5_val

The delimiter is ‘|’

col1, col2, col3 are NOT NULL columns in source and destination tables.

However, in source table, in some of the rows, col2 and col3 are having spaces in them instead of character values.

These are coming in .dat file as below:

abc| | |def|pqr

Now, during import of above row, these spaces are getting considered as NULL and thus everthing fails on trying to insert a null value in a not null column of destination table.

What is the solution/workaround for this problem ?

Thanks for reading!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:10:36+00:00Added an answer on June 17, 2026 at 5:10 pm

    You can use option KEEPBLANKS and it will not treat the spaces as NULL.

    From IBM DB2 Documentation:

    KEEPBLANKS – Preserves the leading and trailing blanks in each field of type CHAR, VARCHAR, LONG VARCHAR, or CLOB. Without this option, all leading and tailing blanks that are not inside character delimiters are removed, and a NULL is inserted into the table for all blank fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two similar tables in different databases, I want to insert into one
I have two databases at two different places, both databases are same with table
I have two identical tables in two different databases with the same data but
I have two servers which contains a same database, same tables structure with different
I have two tables in different databases on the same database server. Both the
I have two different databases that share some of the same tables, and differ
Scenario I have an TWO datbase tables of exactly the SAME STRUCTURE. The difference
I have a need to sync auto_increment fields between two tables in different databases
I have an HTML document where I have two different tables. One is class
i have two tables one is called addons and holds information about different addons,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.