How to export data from a specific table in DB2?
You can use the EXPORT command in the DB2 database to export data from a specific table. Here is an example:
- Open the console or terminal and log in to the DB2 database.
- Switch to the database where you want to export the data using the following command:
db2 connect to database_name
- Then export data from the specified table using the following command:
db2 "export to output_file of del select * from schema_name.table_name"
output_file is the path and name of the file where the exported data will be stored, schema_name is the name of the schema where the table is located, and table_name is the name of the table from which data will be exported.
- After executing the command, the system will export the data of the specified table to the designated file.
Please note that the exported file format is comma-separated (.del file), you can open or import the file using the appropriate tool.