In your database schema have one column set up to use the
create table myTable(
ID int not null IDENTITY(1,1)
This will automatically create an ID starting at 1
and incrementing by 1 each time a row is added
. It will automatically handle any rows that are deleted from the table ensuring that the ID is always unique.
See this link
] for the documentation