Solved

string remove character if ' '

Posted on 2012-03-11
2
207 Views
Last Modified: 2012-06-21
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".
0
Comment
Question by:johnkainn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 9

Assisted Solution

by:macarrillo1
macarrillo1 earned 500 total points
ID: 37707382
try :

select ltrim(MyColumn)
from Table
0
 
LVL 9

Accepted Solution

by:
macarrillo1 earned 500 total points
ID: 37707390
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
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question