habib ullah

habib ullah

  • NA
  • 229
  • 14k

how to increase the values of varchar colum

Apr 12 2018 12:04 AM
how to increase the value of varchar columns and assing the specific pattern
code is the cannot the increment
my store procedure is that
ALTER PROCEDURE [School].[GetRegisterationNumber]
AS
begin
declare @StudentRegNo nvarchar(50)
set @StudentRegNo=(select MAX(StudentRegNo)from School.StudentInformation)
if @StudentRegNo is null
begin
set @StudentRegNo='OXPS-0001'
select @StudentRegNo
end
else
begin
select 'OXPS'+'-'+RIGHT('0000'+ convert(varchar(10),@StudentRegNo),4)
--set @StudentRegNo=SCOPE_IDENTITY()
end
end
 

Answers (5)