If I understand, what aboutSelect top 200 Customercode
case when IsNumeric(Customercode) = 1 then Replicate('0', 100 - Len(Customercode)) + CustomerCode
else Customercode end AS Customercode
from Customer
where Customercode is not null
case when IsNumeric(Customercode) = 1 then Replicate('0', 100 - Len(Customercode)) + CustomerCode else Customercode end = 'myvalue'
order by 1
djj