Subject Re: [firebird-support] Batch Insert from external table
Author Milan Babuskov
m_apessos wrote:
> The problem is with the columns of type char or varchar. I noticed
> that
> in MYTABLE all the similar typed columns where right-padded with
> spaces
> to the full length of each column as declared in the external table.
>
> To solve that I used the rtrim UDF from ib_udf.dll and my statement
> became like this:
>
> INSERT INTO MYTABLE (COLUMN1, COLUMN2, ...)
> SELECT NULLIF(RTRIM(COLUMN1),''), NULLIF(RTRIM(COLUMN2),''), ...
> FROM MYEXTERNALTABLE
>
> The results where the same!!
>
> Does anyone have an idea how to overcome tha problem?

Just cast RTRIM result as varchar and you're done:

select nullif(cast(rtrim(column1) as varchar(255),'')

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org