db2 query results export csv file, and the solution to open csv data type with Excel shows garbled characters or the last few digits of the data become 0

Problem Description:

The result of the db2 query wants to export the csv table

This can be achieved with the following commands:

db2 "export to '/home/temp/result.csv' of del modified by nochardel select * from tablename"

The result.csv can be opened with Excel or saved as a .xlsx file.

Nochardel in the command
means not to use " as a separator.
Other parameters will be added later~


There is a problem:

The .csv table exported by the db2 command, when opened with Excel, may be due to the data type, which shows garbled characters or the last few digits of the data change to 0. For the
solution, please refer to the following blog post, which is very detailed and effective in personal testing

After opening the CSV format with EXCEL, the last few digits of the number become 0


Guess you like

Origin blog.csdn.net/qq_39691492/article/details/126604188