0

How can I update and replace part of string/text in SQL?

I want to be able to update my Article table, and substitute all of ’ with ' in Description field. How can something like this be done?

3 Answers 3

3
UPDATE Article 
SET Description  = REPLACE(Description , '’', '''')
Sign up to request clarification or add additional context in comments.

Comments

0

REPLACE(COLUMN_NAME,'’','''')

1 Comment

Modified Query after Goat Co's comment
0

TRY this out.

UPDATE Article
set Description = replace(Description, '’','''')

4 Comments

This will throw an error, I think. Your UPDATE syntax has extra TABLE key word in it and your replacement value is a and empty string '' and an extra single quote '.it should be ''''
the user wanted it to be single qoute as per his requirements. please see the question once
Msg 105, Level 15, State 1, Line 1 Unclosed quotation mark after the character string '') To get a single quote, you need '''' in the third parameter of the REPLACE() function.
@M.Ali its okay, i am here to learn. the more i get to critic the more i learn . Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.