'Replace new line from the end of string SQL and update columns

I have a table called Players with two columns Name and PlayerID. I am using SQLite under DB Browser for SQLite.

Unfortunately, all my player's names have a something like a "\n" (a newline) at the end of their Name.

Ex:

"Mark
"

I tried to use Update & Replace for all the names with the following query (I have like 450 rows in the table):

UPDATE Players
SET Name = REPLACE(Name,CHAR(10),'')
WHERE PlayerID <= 500

When I execute something like:

SELECT * FROM Players
WHERE Players.Name LIKE 'Mark'

it'll return no rows because of the end line. Here 'Mark' has no "\n", so it won't be found.

If I execute:

SELECT * FROM Players
WHERE Players.Name LIKE 'Mark
'

it will return my player. (after Mark I pressed enter)

I want to change all my rows from this format

"Mark
"

to this

"Mark"

and save all the changes.

How can I solve my problem? What's wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source