简体   繁体   English

如何在 postgresql 中将 'S 替换为 a'?

[英]how can i replace the 'S for a 's in postgresql?

I have a table with large amount of 'S wrongly added and i want to replace it for 's:我有一张错误添加了大量 'S 的表格,我想将其替换为 's:

I have tried with replace(field, ''S', ''s') but obviously doesn't accept it for the ', I also tired with the $$'$$ but still doesn't work.我试过用replace(field, ''S', ''s')但显然不接受它,我也厌倦了 $$'$$ 但仍然不起作用。

The current version of PostgreSQL is 11 I have look into different threads and tried the solution there but didn't recognize ie PostgreSQL 的当前版本是 11 我查看了不同的线程并尝试了那里的解决方案,但没有识别出 ie

Replace apostrophe in string 替换字符串中的撇号

The quote is the escape character for quotes as well.引号也是引号的转义字符。 So you need one more quote for each string: replace(field, '''S', '''s')所以你需要为每个字符串多加一个引号: replace(field, '''S', '''s')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM