UNLOAD STATEMENT - Blank Fields Wanted
Posted in 2003
Topics: Migration, Import/Export & Data Conversion
I thought I've seen this before, but I can't find my reference.
What I need is to do the following statement:
UNLOAD TO "./ord_reg.unl"
SELECT or_id, "|", or_company, "|", or_addr1
FROM ord_reg;
Can I add blank fields while unloading my table?
My intention is to unload the fields (with blanks included), drop the
table, create a new altered table, and load the info back in.
This would be helpful if it can be done.
Thanks in advance,
Tyler
On Fri, 05 Sep 2003 12:18:25 -0400, TylerB wrote:
It is easier to just do a straight unload (or use Jonathan Leffler's
sqlunload/sqlcmd utility) and then recreate the table with new columns and use
dbload to load the unload file just into the old columns leaving NULLs in the
new columns. Then update the new columns to spaces.
Of course the easiest thing of all is to just ALTER TABLE to insert the new
columns either with DEFAULT " " or update afterwards. Informix has always been
able to add columns to an existing table without having to drop and recreate it
(unlike some other Larry-come-lately database systems), and since 7.3x IDS can
perform the ALTER in-place without physically copying the data to a new table!
Syntax:
ALTER TABLE ord_reg ADD (new_col_1 CHAR(100), ...);
or if you do not want the new columns at the end of the record:
ALTER TABLE ord_reg ADD (new_col_1 CHAR(100) BEFORE old_col_3, ...);
Art S. Kagel
> I thought I've seen this before, but I can't find my reference. What I need is
> to do the following statement:
>
> UNLOAD TO "./ord_reg.unl"
> SELECT or_id, "|", or_company, "|", or_addr1
> FROM ord_reg;>
> Can I add blank fields while unloading my table? My intention is to unload the
> fields (with blanks included), drop the table, create a new altered table, and
> load the info back in.
>
> This would be helpful if it can be done.
>
> Thanks in advance,
> Tyler