April 12, 2010 at 2:50 pm
I have a data field which has data like below
00123456
0012345
00234234
0098765
00012345
I need to manipulate the data to skip the leading zereos, regardless of the length
So my result set should be
123456
12345
234234
98765
012345
April 12, 2010 at 2:57 pm
Does this help?
create table #TestTab (
Col1 varchar(12)
);
insert into #TestTab
select '00123456' union all
select '0012345' union all
select '00234234' union all
select '0098765' union all
select '00012345';
select
right(Col1, len(Col1) - 2)
from
#TestTab;
April 12, 2010 at 2:59 pm
Duh, thanks, afternoon brain freeze, i was going the whole substring road, making it way more complicated.
April 12, 2010 at 3:04 pm
Will every row have at least two leading 0s?
April 12, 2010 at 3:15 pm
yes
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply