happysmile
happysmile

Reputation: 7777

how to replace text in a particular column on a table in sqlserver

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>.

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

Upvotes: 3

Views: 3362

Answers (2)

codingbadger
codingbadger

Reputation: 44032

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.

Upvotes: 4

The Scrum Meister
The Scrum Meister

Reputation: 30131

Use the REPLACE function with a UPDATE statement:

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

Upvotes: 2

Related Questions