I have one table called customer_master
that includes a column called cust_id
with autoincrement set to 1.
When we try to insert records its working fine and inserted records like cust_id
1, 2, 3 and 4 are inserted, but when an error is generated in the insert command we do a transaction rollback, this means that cust_id
5 is not inserted, but when we are insert another record, cust_id
generates 6. It skips cust_id
5.
I want to set it up so that if any error is generated in the insert command the identity is not incremented.
We are using c# and sql server 2005.