create function get_code() returns char(10) as begin declare @lastval char(5) set @lastval = (select max(advisor_code) from tbl_advisor_table) if @lastval is null set @lastval = 'DFP' declare @i int set @i = right(@lastval,4) + 1 return 'C' + right('000' + convert(varchar(10),@i),4) end
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)