declare @t table(code varchar(20)) insert into @t select 'a003' union all select 'b005' union all select 'c993' union all select 'd0433' union all select '9022'select cast(right(code,lenght(code)-1) as int) from @t
declare @t table(code varchar(20)) insert into @t select 'a003' union all select 'b005' union all select 'c993' union all select 'd0433' union all select '9022'select cast(right(code,len(code)-1) as int) as Code from @t/* Code ----------- 3 5 993 433 22 */
insert into @t select 'a003'
union all select 'b005'
union all select 'c993'
union all select 'd0433'
union all select '9022'select cast(right(code,lenght(code)-1) as int) from @t
insert into @t select 'a003'
union all select 'b005'
union all select 'c993'
union all select 'd0433'
union all select '9022'select cast(right(code,len(code)-1) as int) as Code from @t/*
Code
-----------
3
5
993
433
22
*/