Db2 export command example using file format (del , ixf)
You want to transfer data from a db2 database table
to another db2 database or within the same database, one of the way is to use
db2 export / import command. Using db2 export / import you can move your data
to excel also.
DB2 export command exports data selected by SQL statement from a table or view to an external files in the format of del - delimited , wsf - worksheet format , ixf - Integration Exchange Format,asc.
The DEL format uses delimiter and column separator and decimal point. The default string delimiter is double quote " and column separator is comma(,) and Decimal Point is dot(.), you can also specify your own string delimiter & column separator, decimal point. Another format supported by DB2 is IXF (Integration Exchange Format). It is a generic relational database exchange format which supports an end-of-record delimiter . IXF architecture supports to exchange of relational database structures and data. IXF is used for transferring data across platforms. The following examples illustrates the use of Export command. You can see more about db2 import command at db2 import.
Example 1 : Export all rows in the Emp table to the file emp.ixf with message file msgs.txt for writing the messages or warnings
db2 export to emp.ixf of ixf messages msgs.txt select * from emp
Example 2:The following command exports all rows in the Employee table to the file emp.del.
db2 export to emp.del of del select * from employee
Example 3: The following command exports all rows in the Employee table to the file employee.del using the column delimiter semi colon(;) and string delimiter single quote (') and the decimal point comma,
db2 export to emp.del of del modified by chardel''
coldel; decpt, select * from emp
Output of the above is command is as follows.
'10';'XYZ';+001,00;+0020,00
Comments
Post a Comment