Create Sequence in SQL
CREATE SEQUENCE Seq_AccountNumber As BigInt
Start with 100001
INCREMENT BY 1
MINVALUE 1
MAXVALUE 999999999999999999
CYCLE
CACHE;
Use Sequence in Procedure for generating numbers Like "Sbank_10001".
CREATE Proc Proc_GenerateAccountNumber
as
Declare @BnkName varchar(100)='Sbank_';
Declare @AccountNumber varchar(max);
SELECT @AccountNumber =CONCAT(@BnkName ,
next value for dbo.Seq_AccountNumber
)
SELECT @AccountNumber as AccountNumber
Return
Now execute procedure "Proc_GenerateAccountNumber" & check output
If you want to restart Sequence Alter Sequence,
alter sequence dbo.Seq_AccountNumber Restart with 10001