RE: unload and null values
Posted in 1999
I tried this also.
unload to test.unl select col1, "" from table
I received this:
1||
2||
3||
4||
5||
Just to make sure I had a null in the second column I created a table
that would not accept
nulls in the second column. I tried to load the new .unl file into the
test table. I received
an error that said unable to insert null into column.
On-Line 7
Matt C.
POS Programmer
Hastings Corp.
> -----Original Message-----
> From: Robert Taylor [SMTP:robertt@scotlegal.com]
> Sent: Friday, July 23, 1999 8:47 AM
> To: informix-list@iiug.org
> Subject: Re: unload and null values
>
> I see exactly what you mean. I just tried what you tried and different
> combinations of it. I don't think there is any way around it in SQL.
> I think your temporary table is the best bet. I suppose you could have
> a
> null table ( just one column containing null ) in your database with
> one
> row.
>
> Its not that untidy. But its starting to bug me the more I think about
> it
> ..... : )
>
> Steve Wright <steve@wrightnet.demon.co.uk> wrote in message
> news:Pzo75GAUv6k3EwHq@wrightnet.demon.co.uk...
> > I need to create an unload file with a null value in the 2nd column.
> >
> > I have tried
> >
> > SELECT col1, ""
> > FROM table> >
> > But this extracts the following;
> >
> > 123|\\ |
> >
> > We have solutions that work, neither of which is pretty;
> >
> > Solution 1
> > ----------
> >
> > SELECT col1, "NULL-VALUE"
> > FROM table> >
> > and then pipe the unload file through sed and substitute
> "NULL-VALUE"
> >
> > Solution 2
> > ----------
> >
> > CREATE dummy_table (dummy_column CHAR(1));
> > SELECT col1, dummy_column
> > FROM table, OUTER dummy_table
> > WHERE col1 = dummy_column
> > ...
> > DROP TABLE dummy_table> >
> > Is there a neater way of doing this?
> >
> >
> > --
> > Steve Wright
>