Home > Enterprise >  Trying to Remove Leading and Trailing Spaces using Trim but its not Working
Trying to Remove Leading and Trailing Spaces using Trim but its not Working

Time:09-29

I've tried

update Table_Name set Name=Trim(Name)

But its not working ..the string in which i want to remove leading and trailing spaces is as follows:

'  % of critical assets, that should be monitored via PdM technologies, are being monitored '

which is currently in the column named as Name from my table

CodePudding user response:

If the datatype is CHAR or NCHAR, you cannot remove trailing spaces. You can only do that on VARCHAR/NVARCHAR

CodePudding user response:

Try using

update Table_Name set Name=LTRIM(RTRIM(Name)) 

instead of TRIM

  • Related