Suppose #AccountCodes is your real table,
CREATE TABLE #AccountCodes
( [accountCode] varchar(30))
;
INSERT INTO #AccountCodes
([accountCode])
VALUES
( 'A99'),
( 'A379'),
( 'A230'),
('A2323'),
('A23'),
('A21333'),
('AB23'),
('EXMPLECODE')
;
Now create one #temp table
CREATE TABLE #temp (ID int identity(1,1) primary key, [accountCode] varchar(30))
insert into #temp([accountCode])
select accountcode from
(
select *
,cast(substring(accountcode,(PATINDEX('%[0-9]%',accountcode)),len(accountcode)) as int)newCode
from #AccountCodes
where PATINDEX('%[0-9]%',accountcode)>0
)t4
order by newCode
insert into #temp([accountCode])
select [accountCode]
from #AccountCodes
where PATINDEX('%[0-9]%',accountcode)<=0
order by [accountCode]
select * from #temp order by id
drop table #AccountCodes,#temp
You can throw sample data where it not working