Here is my code
Create function [dbo].[CASNo]()
returns varchar(20) as
begin
DECLARE @lastval INT
SET @lastval = (select MAX(Cast(right(CAS_No,4) as varchar(10))) from tblCASdetails)
if @lastval is null set @lastval = 0
Return 'CAS-' + right('000' + convert(varchar(50),(@lastval + 1)),10)
end
Jayesh VaghasiyaPosted Sep 17, 2018, 7:40 AM
Methoun AhmedPosted Sep 13, 2018, 2:00 PM
Bryian TanPosted Sep 10, 2018, 10:10 PM