sql server 2005 - identity to be incremented only if record is inserted -
SQL Server 2005: I have empid a column on the identity in the employee table. If there is some error during data entry in the table, the excess has increased. If identity is recorded then only identity should be increased. Like I have generated an EMP ID from 1 to 5 and then on the 6th record entry error occurers And the next record entry will be 7 at the identity value. I want it 6.
Why do you want to do this?
The identity column should only be used as an 'internal administrative value' for the database, and there should not be any 'business value', so why does it matter that there is a gap in that order ?
If the identity is used correctly, the users of your software will never encounter that column with the identity value; You use it for a specific identification of a record.
Comments
Post a Comment