Hello dharmendr,
I followed the link and auto increment based on last value works fine but there are quite a few concerns about that method in multiuser interfaces.
The main concern is that if concurrent users insert data into the database, the likelyhood of having duplicate auto increment number is high.
So I made more search and found two options, either using a computed persisted column or using a sequence.
I chose using a sequence and implemented as follows:
CREATE SEQUENCE seq_test
AS INT
START WITH 1
INCREMENT BY 1
MINVALUE 1
NO MAXVALUE
NO CYCLE
CACHE 10;
And to call the sequence during insert:
INSERT INTO mytable
(my_id, firstname)
VALUES
(NEXT VALUE FOR seq_test, 'David');
This works fine for me
Thanks