importing data with commas in numeric fields into

2019-07-11 05:33发布

I am importing data into redshift using the SQL COPY statement. The data has comma thousands separators in the numeric fields which the COPY statement rejects.

The COPY statement has a number of options to specify field separators, date and time formats and NULL values. However I do not see anything to specify number formatting.

Do I need to preprocess the data before loading or is there a way to get redshift to parse the numbers corerctly?

1条回答
不美不萌又怎样
2楼-- · 2019-07-11 06:15
  1. Import the columns as TEXT data type in a temporary table
  2. Insert the temporary table to your target table. Have your SELECT statement for the INSERT replace commas with empty strings, and cast the values to the correct numeric type.
查看更多
登录 后发表回答