We help IT Professionals succeed at work.

string remove character if ' '

johnkainn asked
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".
Watch Question

Michael CarrilloInformation Systems Manager
Top Expert 2012
try :

select ltrim(MyColumn)
from Table
Information Systems Manager
Top Expert 2012
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.