SQL Server Forums
Profile | Register | 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
 New Topic  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
Constraint Violating Yak Guru

Romania
276 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
158 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  
 New 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.05 seconds. Powered By: Snitz Forums 2000