amazon-redshift - Redshift : how to remove all newline characters in a field

标签 amazon-redshift

我想知道如何从字段中删除 Redshift 中的所有换行符。我试过这样的事情:

replace(replace(body, '\n', ' '), '\r', ' ')


regexp_replace(body, '[\n\r]+', ' ')

但它没有用。如果您知道如何执行此操作,请分享。

最佳答案

使用 chr(10) 而不是 \n
例子:

select replace(CONCAT('Text 1' , chr(10), 'Text 2'), chr(10), '-') as txt

关于amazon-redshift - Redshift : how to remove all newline characters in a field,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32367106/

相关文章:

postgresql - 按案例排序和序号不起作用

c# - Azure C# 应用服务 ODBC 连接到 Redshift

sql - 您如何从 Redshift 将数据卸载到 S3 并在文件名中包含日期

amazon-redshift - AWS Glue:如何使用各种模式处理嵌套JSON

azure - 打开 Redshift 和数据工厂的 IP 地址

postgresql - 从 Redshift 卸载到 S3 : Authentication not working

postgresql - Redshift 连接问题 : FATAL: password authentication failed for user

amazon-web-services - Amazon Redshift 是否支持扩展 dblink?

sql - Redshift 数据库的透视

mysql - Redshift 插入多行