I have a table called Players and columns Name, PlayerID. I am using sqlite under DB Browser for SQLite.
Unfortunately, all my player's names have a something like a "\n" (turned out to be a /r) at the end of the name.
Ex:
"Mark
"
I tried to Update & Replace 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.
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?
Best Answer
If you want to remove all line feed characters (
\n
), then what you have is ok. You could also remove theWHERE
, to update all rows:Similarly, if you want to remove all spaces, do the same:
Beware though that the above will change
'Mark Jenkins'
to'MarkJenkins'
. Are you sure you want to do that?You could also do both actions in a single statement, with:
Before running the actual update, you could examine the changes with: