Solved

string remove character if ' '

Posted on 2012-03-11
2
206 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
  • 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error Creating Foreign Keys in SQL Database 7 45
Query to return total 6 23
This query failed in sql 2014 5 33
domain login has permission in database, but gets error 3 18
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

820 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