将数字字段中的逗号数据导入redshift [英] importing data with commas in numeric fields into redshift

查看:122
本文介绍了将数字字段中的逗号数据导入redshift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SQL COPY 语句将数据导入redshift。数据在 COPY 语句拒绝的数字字段中以逗号分隔。

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.

COPY 语句具有许多选项来指定字段分隔符,日期和时间格式以及NULL值。但是,我看不到要指定数字格式的任何内容。

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.

我是否需要在加载之前对数据进行预处理,或者是否有办法使redshift准确解析数字?

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

推荐答案


  1. 将列作为TEXT数据类型导入到临时表中

  2. 将临时表插入目标表。让INSERT的SELECT语句用空字符串替换逗号,并将值转换为正确的数字类型。

这篇关于将数字字段中的逗号数据导入redshift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆