简体   繁体   中英

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

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

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

Try using

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

instead of TRIM

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM