Lets say I have a session table like this:
[Session]
-------
Id: int
UserId: int
Imagine that is used in an extremely high traffic site and Sessions are very frequently added and deleted. If I were to make the Id column of each table an Identity column, how could I easily maintain the seeding of the Id’s so that they don’t hit the limits of the int data type? Is there an alternative way of ensuring unique Id’s that I’m not thinking of? Thanks in advance.
instead of int make it bigint, this will go up to 9,223,372,036,854,775,807
you can of course start at -9,223,372,036,854,775,808 as well
see also What To Do When Your Identity Column Maxes Out