user9969
user9969

Reputation: 16060

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

Upvotes: 1

Views: 536

Answers (1)

Hiren gardhariya
Hiren gardhariya

Reputation: 1247

For Rtrim you can use

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

Select Rtrim(@temp) 

Output:= 99999

Upvotes: 1

Related Questions