Use Tab, Please
If you want to export a database table as a plain text file you have some options. One approach is to use a fixed width format. This format tends to be favoured by databases like Oracle or DB2 where the text fields in the table index have a fixed width defined. The trouble with this representation is that it is larger than necessary and to import the data you need to define the field widths. This can sometimes be inferred from the location of spaces but if the fields are fully filled, as with numeric fields, the location of the field breaks must be known.
Another approach is the popular CSV format. In its simple form this uses a comma between each field. But comma is a common character so then text qualifiers, using quotes are added. However, quotes can also occur in the text, so then escape characters are introduced, sometimes slash, sometimes double quote. I'm not making this up! An escape for a qualifier for a badly chosen separator.
A third approach is to use the tab character. This is the character which the clever folks who drew up the ASCII character set thought to set aside for... creating tabulated data. Using tab means that there is no need for qualifiers, escapes or figuring out where fields end in a fixed width format. If tab does happen to occur in your field data it can in almost all cases be safely replaced by a space character.
This may very well be the most trivial thing you've ever read. But since you are still here, please, next time you see this screen just choose tab separators with no text qualifiers. Just as soon as everyone does that I won't mention is again, I promise.

Recent Comments