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

Mohan ArumugamRank #5,109 · 311 reputationPosted Apr 11, 2018, 8:52 PM EDT
Raghavendar SwaminathanRank #788 · 2.9K reputationPosted Apr 11, 2018, 8:58 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 11, 2018, 9:50 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 11, 2018, 10:15 PM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 14, 2019, 7:32 AM EST