Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Ltrim Issue

Author  Topic 

raky
Aged Yak Warrior

767 Posts

Posted - 2009-12-20 : 06:41:39
Hi iam having problem with removing leading empty space..for example just check this

declare @i varchar(100)
select @i = ' © 1998 Municipal corporation.'

select @i 'originalValue',ltrim(@i) 'ModifiedValue'

but iam still seeing leading space under ModifiedValue column

Please suggest how can i remove leading empty space??
expected output is

ModifiedValue:© 1998 Municipal corporation.

Due to urgency iam posting in both new to sql server forums as well as in Transact-SQL. Please respond as early as possible.

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2009-12-20 : 08:43:41
try this, the value is not space actually its tab/newline

declare @i varchar(100)
select @i = ' © 1998 Municipal corporation.'

select @i 'originalValue',replace(@i, char(9), '') 'ModifiedValue'

"There is only one difference between a dream and an aim.
A dream requires soundless sleep to see,
whereas an aim requires sleepless efforts to achieve..!!"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-12-20 : 10:51:14
Duplicate post http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=137432



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -