0

I'd like to replace ); " in column "Note" with )Carriage Return", but with the condition that "Phrase" column (BOOL) is set as TRUE. I tried using the following query but that didn't work:

SELECT 
  * 
FROM "Slovník";
UPDATE Slovník
WHERE   Phrase = 1
SET Note = replace(Note, '); "', ')CHAR(13)"');

In other words, I'd like to replace a semicolon with a line break in the column Note in my database under the above conditions: [screenshot][1]

To avoid the semicolon being replaced somewhere else, (somewhere other than between the sentence examples), I have to include the extra characters, such as ); "

(Please let me know if my question isn't clear enough and I'll try to clarify.)

1 Answer 1

1

Use the concatenation operator || with the function CHAR() and don't wrap the function inside the single quotes:

UPDATE [Slovník]
SET Note = replace(Note, '); "', ')' || CHAR(13) || '"')
WHERE   Phrase = 1

It's better to use this WHERE clause:

WHERE   Phrase = 1 AND Note LIKE '%); "%'

to avoid unnecessary updates for the rows that do not contain '); "'.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for you reply, unfortunately that didn't work for me either. I get a syntax error.

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.