简体   繁体   中英

RTrim not working in sql server 2005-2008

Looked over the net but could find a solution

Could anybody tell me why the following would not work?Am I missing the obvious!!

SELECT RTRIM('99999        ') 

You cannot see very well from above after 99999 I have many empty spaces.

My column contains numbers and I could do

SELECT LEFT(Myfield, 8) 

and this would work but I don't know the length of the column.

Any suggestions?

Thanks

For Rtrim you can use

Declare @temp varchar(100)
Set @temp = '99999       '

Select Rtrim(@temp) 

Output:= 99999

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