COPY with FILLER when NULL in file issues

Hi all,


I have a certain usecase for which I am unable to figure out a solution.


I am using a file to load data into a table. The table has a column which has NOT NULL constraint applied on it. There are trailing spaces in the other entires of the same file which need to be trimmed to match the data. There is data which has SINGLE SPACE (' ') as well.


I have used the below example:


COPY table1 (col1_filler filler varchar(3), col1 as trim(TRAILING from col1_filler )) from file.out delimiter '~'


I want to know how can I put these values into the table and also fix the same issue of trimming data and keeping the SINGLE space from the file.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file