Can you help to understand why I can not remove trailing spaces (at least how I can see them) from my city column, sorry can’t do true replication code, after paste copy it’s not reproducible. So pasting result from my original source.
I tried to reproduce this but can not, so pasting my SQL along with the screenshot of output, can not understand why I have trailing spaces in column city1
SELECT
TOP 100
m_city,
convert( varbinary, m_city ) cityBarBin,
LEN( m_city ) Lenx,
m_city + '.' city1,
LTRIM( RTRIM( m_city ) ) + '. ' cityRtrim,
substring( m_city, 1, LEN( m_city ) ) + '.' citySubs,
REPLACE( m_city, ' ', '' ) + '.' cityReplace
FROM
myTable
Another strange thing there is no any effect after I ran update for this column
UPDATE
myTable
SET
m_city = SUBSTRING( m_city, 1, LEN( m_city ) ) -- or RTRIM(m_city)
After this update, select produces very same results.
Microsoft SQL Server 2016 (SP2-CU15) (KB4577775).
Column defined as : `m_city char(20) Collation
SQL_Latin1_General_CP1_CI_AS`
Thanks
6