The following article describes how to move data into or out of a database in a DB2 database table, I saw on the relevant website two days ago the actual operation steps for migrating data into or out of the database in the DB2 database table. I thought it was good and I would like to share it with you.
After creating a table that stores data in the DB2 database, you must be able to move the data into or out of the table. The simplest way to put data into a table is to use the INSERT command. To insert data, you must provide the tables and columns you want to insert and the data itself.
After creating a table that stores data in the DB2 database, you must be able to move the data into or out of the table. The simplest way to put data into a table is to use the INSERT command. To insert data, you must provide the tables and columns you want to insert and the data itself. After inserting data, you can select, update, or delete it.
This exercise demonstrates how to move data into or out of the database.
In the Control Center Object view, select the AUTHOR table in the Database List and click Open.
Figure 1. Control Center -- open a table
As shown in, click Add Row. Input the data in the column and submit the transaction.
Figure 2. Add rows
If no error occurs, no feedback is provided. Click Close to Close the Open Table window.
Open Command Editor through Tools> Command Editor. Manually enter the INSERT command, including the statements used to connect to the DB2 database:
- connect to hellowld;
- insert into hwld.author values ('Claire', 1, 'DB2 UDB',
- '<author_info>
- <name>Claire</name>
- <ID>1</ID>
- <department>
- <department_title>DB2 CE</department_title>
- <responsibility>Supporting customer problems</responsibility>
- <start_year>2005</start_year>
- </department>
- <department>
- <department_title>DB2 Index Manager</department_title>
- <responsibility>Develop new features for DB2 indexes</responsibility>
- <start_year/>
- </department>
- </author_info>', 100);
- terminate;
(You can also use the command to edit the view to perform the same operation .)
Click the green triangle icon to run the command. Figure 3 shows the expected running results:
Figure 3. Command Editor -- insert
If there is data that is no longer needed in the table, you can delete it in the same window. Click AUTHOR and Open.
Select the first Row and click Delete Row. Click Commit to submit the deletion operation. If you decide to abort the delete operation, click Roll Back instead of Commit.
Click another row and delete it to clear the table, and then click Close. The above content describes how to move data into or out of the database in the DB2 database table, hoping to help you in this regard.