I have a string of type VARCHAR(128)
in MS SQL Server, which has this value: 'abc '.
However, these trailing "spaces" are not regular spaces (ASCII 32), they are of ASCII 0. I want to trim these trailing "spaces", but I could not get it to work.
I have tried the following approaches:
ltrim
and rtrim
replace('abc ', CHAR(0), '')
substring('abc ', 0, charindex(CHAR(0), 'abc '))
But none of these seem to work as intended.
How can I remove these trailing ASCII 0 characters from the string?