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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Remove one space from leading spaces

Author  Topic 

jayram11
Yak Posting Veteran

97 Posts

Posted - 2010-06-28 : 13:46:14
This might sound a little wired but i wan to remove one leading space from a column which could have many leading spaces.
to be more clear, if the record has 5 leading spaces i want to male it 4, if it has 4 i want 3 and if it has 1 i want 0...

is there a way to use Trim or Replace function??
thnx

Sachin.Nand

2937 Posts

Posted - 2010-06-28 : 14:00:57
Cant you do that at the front end?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

jayram11
Yak Posting Veteran

97 Posts

Posted - 2010-06-28 : 14:02:58
Unfortunately no....
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2010-06-28 : 14:08:55
select substring(yourcolumn,2,100)

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

jayram11
Yak Posting Veteran

97 Posts

Posted - 2010-06-28 : 14:19:21
Thanks Jimf...awesome and simple
Go to Top of Page
   

- Advertisement -