How to auto increment an id in SQL Server whenever a new row is inserted in the table? This id is primary key of the table.
A:
And to return the id in your code lookup scope_identity() and the OUTPUT clause. De not use @@identity as it can return the wrong value if triggers are put on the table, therefore it is not safe to use if you value data integrity.
HLGEM
2010-05-05 13:45:48