+ 1
How to Trim all trailing and leading characters in a varchar
declare @message varchar (20), @trimmedMsg varchar(20) set @message = ' testmsg ' set @trimmedMsg = LTRIM(RTRIM(@message)) Is there any better way to do this
1 Answer
0
Can you use just TRIM ?
set @trimmedMsg = TRIM(@message))
Which sql are you using ?
https://docs.microsoft.com/en-us/sql/t-sql/functions/trim-transact-sql
http://www.1keydata.com/nl/sql/sql-trim.php
https://blog.sqlauthority.com/2007/04/24/sql-server-trim-function-udf-trim/