I try to output everything from temp table to csv on local drive in SQL Workbench (Redshift Amazon Server)
SELECT * FROM #IDTable INTO OUTFILE 'C:\\Users\\MYAN\\Documents\\out.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n';
Then I run into error message as follows:
Amazon Invalid operation: syntax error at or near "INTO" Position: 24;
Could anyone help with it? Thank you!!
You can not do like this on Amazon-Redshift, either you have to use 'S3' or any 'EC-2' instance to output your select query.
The unload syntax would go like this.
UNLOAD ('select-statement') TO 's3://object-path/name-prefix' authorization [ option [ ... ] ]
Refer Redshif documents online here.https://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html