I have done OCR on some books’ titles which, for some reason, added line breaks too. Now I want to bulk remove/update them all permanently, not in select view. These are the queries I am running
SELECT Replace(BOOKTITLE, Char(13) + Char(10), ''),
Len(Replace(BOOKTITLE, Char(13) + Char(10), ''))
FROM BOOKTABLE;
SELECT BOOKTITLE AS [(No column name)],
Len(BOOKTITLE)
FROM BOOKTABLE;
which yield following results
How can I get it done?
Advertisement
Answer
If line breaks are always at the end of BOOKTITLE then you can do this update
UPDATE BOOKTABLE SET BOOKTITLE = LEFT(BOOKTITLE, LEN(BOOKTITLE) - 2)
