如何在SQL Server中有条件地替换字符

时间:2017-10-23 10:23:12

标签: sql-server replace str-replace

我在SQL Server表的一列中有一些文本:

text_col
-----------------------------------------------
{"hello:"a wing"}
{"This is your"s computer"}
{"long address:flower valley, green"s point"}
{"long address:"A wing, 3 cross road"}

预期产出:

text_col
-------------------------------------------------
{"hello:"a wing"}
{"This is your's computer"}
{"long address:flower valley, green's point"}
{"long address:'A wing, 3 cross road"}

我想做的事情:如果"前面有字母并以空格结尾,我只想用'替换UPDATE <table_name> SET <column_name> = REPLACE(<column_name>,'#','''') WHERE <condition...>

这就是我试过的

element arr[4]

对此相关的任何建议都会有所帮助

由于

0 个答案:

没有答案