Using RTRIM doesn't work!

Hi ,

I simply want to remove a blank space in front of the text (nvarchar) from a list of values in an SQL server 2008 table but it doesn't work, I tried:

UPDATE table01
set field01 = LTRIM(field01).

What am I doing wrong??

Thanks,
mbs2000Asked:
Who is Participating?
 
AnujConnect With a Mentor SQL Server DBACommented:
It may have any carriage return or tab values like CHAR(10) or CHAR(9), try using replace.


 SET Field01=  LTRIM(REPLACE(REPLACE(Field01,CHAR(10),'')),CHAR(9),''))
0
 
Lee SavidgeCommented:
There is nothign wrong with this syntax:

UPDATE table01
set field01 = LTRIM(field01)

Verify the datatype of field01
0
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
are you sure they are the blank spaces.
run a select statement

select field01, ascii(left(filed01,1) )
from your table

check the ascii value table (google) and see it is blank
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mbs2000Author Commented:
Thanks for the feedback, I ran  select field01, ascii(left(filed01,1) ) and it return 160 against all those which look like they have a space. 160= lowercase p and if I can the table there definately isn't a lowercase p at the start of each. I've try update and replace to change 'p' to ' ' but it doesn't work.

Any other ideas?
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
you should use this  

replace (field01, char(160), '' )
0
 
Anthony PerkinsCommented:
>>160= lowercase p <<
Actually no.  lowercase P is 112.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.