Subject RE: [firebird-support] Re: Batch Insert from external table
Author Alan McDonald
> To reproduce the case do the following:
>
> Suppose you have the following data in 'test.ext':
>
> aaaaaaa <CR>
> aaaaa <CR>
> <CR>
>
>
> CREATE MYEXTERNALTABLE EXTERNAL 'test.ext' (
> F1 CHAR(10),
> LF CHAR(2)
> );
>
> CREATE MYTABLE (
> F1 VARCHAR(10)
> );
>
> INSERT INTO MYTABLE (F1)
> SELECT NULLIF(RTRIM(F1,''))
> FROM MYEXTERNALTABLE;
>
> To test the reults run the following:
>
> SELECT F1, STRLEN(F1) FROM MYTABLE;
>
> You wil get this
>
> F1 STRLEN(F1)
> --------------------
> aaaaaaa 10
> aaaaa 10
> <null> 0
>
> (I'm using IB-Expert so if a column is null you get a red <null>)
>
> Hellen, I tried the CASE you proposed like this:
>
> INSERT INTO MYTABLE (F1)
> SELECT
> CASE
> WHEN RTRIM(F1)='' THEN NULL
> ELSE RTRIM(F1)
> END
> FROM MYEXTERNALTABLE;
>
> ...and I got the same results as above.
>
>
> The required result should be this:
>
> F1 STRLEN(F1)
> --------------------
> aaaaaaa 7
> aaaaa 5
> <null> 0

does using LRTRIM make any difference? just think ing it might be a bug in
the function
Alan