The format of external files must first comply with the mandatory requirements of the database. This article will introduce three types of external file formats supported by the DB2 database system for your reference, and hope to help you.
Prior to data import, the DB2 database system often checks the format of external files carefully. If the format of the external file does not meet the mandatory requirements of the database, the database will refuse to import data. This time, I want to introduce four considerations for DB2 database DB2 data import.) What external file formats are supported. We hope this analysis can help the database administrator reduce the workload during data import and export.
1. ASCII file.
It is widely used in the database field. Basically, any database supports external files in this format. However, each database has different requirements on the delimiter used to define ASCII files. In DB2 databases, separators are used to identify the start position and end position of data elements. Generally, DB2 databases support the following separators. The first is the character separator. This character Delimiter is used to define the starting position of the character data type. By default, double quotation marks are used as character delimiters In the DB2 database to improve the efficiency of DB2 data backup and recovery. This is different from other databases. For example, in Oracle databases, when using a bounded ASCII file to import data, it will automatically determine whether the data is a balanced data type, that is, this character separator is not required. The second is the column separator, which is used to define the start position of a field. In most cases, comma (in English) is used as the column separator. However, you can set different column separators, such as colons or semicolons, as needed. No matter which symbol is used as the column separator, a prerequisite must be met, that is, the symbol in the English input stage. If it is a comma or semicolon in Chinese, it is treated as a common character. The third is the line separator. The row delimiter is a special delimiter. Because the operating system platform is different, it uses different row delimiters. For example, in Windows, the line separator is a normal line break. In Linux and other operating systems, although it is also a line break, the line breaks are different on the two operating systems. If you open the ASCII file created on a Windows operating system on a Linux operating system, the format will be messy. If all records are displayed in the same row, it seems that there are no branches. Therefore, when importing data, if the demarcation file is created on the Windwos operating system, and the DB2 database is not on the Linux operating system, the data cannot be imported to the DB2 database. Instead, you must first convert the format to the line break that can be recognized by the Linux operating system. The database administrator must pay enough attention to this issue.
According to the above rules, the following records are the formats supported by the DB2 database:
1001, "office", 2323, "BeiJing",-233