INSERT INTO EXTERNAL CSV Examples
1. Write the contents of the sales table to a file named sales_fact.csv in HDFS location. Indicate null values with the text NULL, separate fields with a comma, and separate records with \n.
INSERT INTO EXTERNAL CSV 'Actian/tmp/sales_fact.csv' SELECT * FROM sales WITH NULL_MARKER='NULL', FIELD_SEPARATOR=',', RECORD_SEPARATOR='\n'
2. Export data in the MY_TABLE table to a file named "mytable" using relative path, and insert the text THIS IS NULL for null values:
INSERT INTO EXTERNAL CSV '/tmp/mytable.csv' SELECT * FROM my_table WITH NULL_MARKER='"THIS IS NULL"'
3. Export data in the supplier table to a file named supplier.csv and insert the text NULL for null values:
INSERT INTO EXTERNAL CSV 'tmp/supplier.csv' SELECT * FROM supplier WITH NULL_MARKER='NULL'