Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Remove first space
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kwacz23
Starting Member

44 Posts

Posted - 08/14/2013 :  04:17:56  Show Profile  Reply with Quote
I would like to only remove first space on the left side if exist.
The issue is because those below values are already in column. (it's not a text)

Example

' Win 7 32bit'- here only remove this first extra space.
'Win 7 32bit'- here should be as it is now

Please help

stepson
Aged Yak Warrior

Romania
545 Posts

Posted - 08/14/2013 :  04:27:40  Show Profile  Reply with Quote
use LTRIM

select LTRIM(' Win 7 32bit')

Ce-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mut
sabinWeb
Go to Top of Page

kwacz23
Starting Member

44 Posts

Posted - 08/14/2013 :  04:29:51  Show Profile  Reply with Quote
It is not work

Select ltrim(response) from mytable

it still giving me ' Win 7 32bit'
Go to Top of Page

kwacz23
Starting Member

44 Posts

Posted - 08/14/2013 :  06:31:51  Show Profile  Reply with Quote
I figured out what was the issue.It turned out that this character was not space but feed line.


(replace(response,char(10),''))
Go to Top of Page

ShivaKrishna
Starting Member

India
20 Posts

Posted - 08/28/2013 :  07:11:35  Show Profile  Reply with Quote
stuff(' Win 7 32bit',1,1,'')
Go to Top of Page

kameswararao polireddy
Starting Member

India
19 Posts

Posted - 08/28/2013 :  11:16:07  Show Profile  Reply with Quote
Hi,
You can use LTRIM() function to complete the process.

SELECT LTRIM(' Win 7 32bit')

P.Kameswara rao
Go to Top of Page

VeeranjaneyuluAnnapureddy
Posting Yak Master

India
169 Posts

Posted - 08/29/2013 :  05:00:50  Show Profile  Reply with Quote
select CONVERT(varchar,ltrim(' Win 7 32bit'))

veeranjaneyulu
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000