We help IT Professionals succeed at work.

string remove character if ' '

johnkainn
johnkainn asked
on
I need to check value in a column and check if there is an empty space as the first character.
If it is I would like to remove the first character. How is best to do that?
For example. Column MyColumn  value=" One". It has an empty space.  It should be value="One".
Comment
Watch Question

Michael CarrilloInformation Systems Manager
Top Expert 2012
Commented:
try :

select ltrim(MyColumn)
from Table
Information Systems Manager
Top Expert 2012
Commented:
Actually, you said that you wanted to change the value so it should be an update statement:

update tablename
set MyColumn=ltrim(MyColumn)
from tablename A, tablename B
where A.ID=B.ID

Explore More ContentExplore courses, solutions, and other research materials related to this topic.