Hi I want to have two tables each have an INT ‘id’ column which will auto-increment but I don’t want either ‘id’ columns to ever share the same number. What is this called and what’s the best way to do it? Sequence? Iterator? Index? Incrementor?
Motivation: we’re migrating from one schema to a another and have a web-page that reads both tables and shows the (int) ID, but I can’t have the same ID used for both tables.
I’m using SQL Server 9.0.3068.
Thanks!
Just configure the identity increment to be >1 e.g. table one uses IDENTITY (1, 10) [1,11,21…] and table two uses IDENTITY (2, 10) [2,12,22…]. This will also give you some room for expansion if needed later.