Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 用不同列中的字符串替换单元格中的部分字符串_Sql_Sql Server - Fatal编程技术网

Sql 用不同列中的字符串替换单元格中的部分字符串

Sql 用不同列中的字符串替换单元格中的部分字符串,sql,sql-server,Sql,Sql Server,我想用同一表中使用的列中的值替换单元格中的字符串 字符串显示“您的奖金是奖金分数”,我想用“奖金分数”列中的数据替换“奖金分数”语句 表结构: person_id nvarchar (8), first_name nvarchar(100), lastname nvarchar(100), text nvarchar(max), text_modified nvarchar(max), bonus_score decimal(10,2) 编辑: O错误地解决了这个问题:这里的目的是获

我想用同一表中使用的列中的值替换单元格中的字符串

字符串显示
“您的奖金是奖金分数”
,我想用
“奖金分数”
列中的数据替换
“奖金分数”语句

表结构:

person_id nvarchar (8), 
first_name nvarchar(100), 
lastname nvarchar(100), 
text nvarchar(max), 
text_modified nvarchar(max), 
bonus_score decimal(10,2)
编辑:
O错误地解决了这个问题:这里的目的是获得自动解决方案,检测“text”中的字符串是否包含表中不同列的任何名称,并自动替换其中的数据。

您可以使用
更新
替换()


像这样的。这将用“奖金分数”列中的值替换文本\u nvarchar列中的字符串“奖金分数”

update tTable
set text_modified=replace(text_nvarchar, 'bonus_score', bonus_score);

欢迎来到堆栈溢出!请阅读中的指南和相应的问题。
update tTable
set text_modified=replace(text_nvarchar, 'bonus_score', bonus_score);