Unload command help
Posted in 1998
Topics: Storage & Space Management, Server Administration, Migration, Import/Export & Data Conversion
I need help with an unload command to do the following:
- The table has one field: field1 char(10)
- All the records in the table look like "0000000ABC" or "0000000AB"
- I need to unload the data into a ASCII file that has no delimiter and
every record is padded with spaces to 20 characters.
Just doing:
dbaccess user@database - << EOF
unload to '/tmp/unload.data'
select field1 from table;EOF
Will create a file that uses the default delimiter ("|") and each record
looks like:
0000000ABC|
0000000AB|
Questions:
What can I use for the delimiter parameter so that I don't get one? I
tried using "delimiter '' " but that puts a \\0 in for the delimiter.
How can I pad each line of data to 20 bytes, with spaces, within the one
line. I could dump the file as described above then use a script to
replace the "|" with the spaces but I would rather do it in one file
(there is almost a million rows of data and I don't have disk space for
a temporary copy).
Also, by default does the LOAD command truncate all trailing blanks?
Thanks,
dave.