GBeezy (5/28/2014)
All,I have a field in AX that is NVARCHAR(30). Sometimes the value has 5 extra characters at the end and sometimes, it does not. I have been attempting to get rid of the trailing spaces and nothing has worked. What I have tried:
1. LTRIM(RTRIM(colA)) AS ColA
2. RTRIM(LTRIM(colA)) AS ColA
3. RTRIM(colA) AS ColA
4. REPLACE(colA), ' ','') AS ColA (my first argument for replace has 5 spaces)
5. REPLACE(colA), ' ','') AS ColA
6. REPLACE(LTRIM(RTRIM(colA))), ' ', '') AS ColA
7. REPLACE(LTRIM(RTRIM(colA))), ' ', '') AS ColA
8. I tried casting it to a VARCHAR and attempting all of the above and that is not working.
I am not sure why this will not work, but if anyone can provide some insight, I would greatly appreciate it.
Just an FYI:
The SET ANSI_PADDING setting does not affect the nchar, nvarchar, ntext, text, image, and large value. They always display the SET ANSI_PADDING ON behavior. This means trailing spaces and zeros are not trimmed.