ASKER
Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.
TRUSTED BY
As Kent mentions above you could use identity column to automatically increase the id column as you insert your data.
Another option is to use sequences, see here and here for further info.
Both identity columns and sequences are supported in Db2 and SQL Server.
>The script will be run in different environments so the last value maybe different.
Note that having identity columns defined in a table you can do regular and bulk inserts where the dbms takes care of assigning the next value to each row and rollback the values if necessary.
This makes it easy to control and have the id values in sync across different dbms.
Also note that identity columns may produce gaps in certain circumstances.
Using sequences gives the opportunity to have the next value logic in the application code and the same value across multiple tables in the same DBMS. However that makes the application responsible for the rollback logic for the values.
Regards,
Tomas Helgi