select 'SP'+ RIGHT('000'+Convert(varchar,ISNULl(Max( Convert(integer,RIGHT(SupplierId, 3))),0)+1 ),3) from TblSuppliers
SupplierId
TblSuppliers
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)