如何替换sqlserver中表中特定列中的文本

时间:2022-05-23 19:18:32

I have an table Employee, with a Description column. In the description column I have the text <br />. Now I need to replace this text with the text <br>.

我有一个表雇员,有一个描述列。在description列中,我有文本
。现在我需要用文本
替换此文本。

Is there any way that i could modify the value in the column itself?

有什么方法可以修改列中的值吗?

2 个解决方案

#1


4  

Update Employee
Set Description = Replace(Description , '<br />','<br>')
Where IDColumn = RecordIdValue

You can omit the where clause if you want to update ALL rows in the table.

如果希望更新表中的所有行,可以省略where子句。

#2


2  

Use the REPLACE function with a UPDATE statement:

使用更新语句替换函数:

UPDATE EMployee
SET Description = REPLACE(Description, 'find this text', 'replacement')

#1


4  

Update Employee
Set Description = Replace(Description , '<br />','<br>')
Where IDColumn = RecordIdValue

You can omit the where clause if you want to update ALL rows in the table.

如果希望更新表中的所有行,可以省略where子句。

#2


2  

Use the REPLACE function with a UPDATE statement:

使用更新语句替换函数:

UPDATE EMployee
SET Description = REPLACE(Description, 'find this text', 'replacement')