Is it possible to increment identity column during UPDATE statement?

Hi,

yosiasz

We have about 10 tables altogether.

One of those tables is called Employees with identity key of EmployeeID.

9 of those tables are related to Employees table by EmployeeID.

Each year, employees are required to submit some sort of disclaimer filled with several other form fields.

The web appp went LIVE last year.

The requirement is that when you load the app and it is your firs time submitting it, the form is blank and you can feel your personal information and then rest of form and then submit.

If you have loaded the app and it turns out that you had submitted it the previous year, your personal information is automatically filled and then you complete rest of the app.

Once the app is submitted, and to query your data for the current year, your employeeID is join to other tables including date table which stores date information that is used to determine whether you had submitted this before or not.

The issue we are having here is that when an employee who had submitted this form the previous year attempts to submit it for the current year, we are getting error that DNULL is not valid for integer value.

Only integer that could be causing this problem is EmployeeID which relates all tables to Employees table.

Although using COALESCE is useless in this case, even using it does not stop the error.

So, what I noticed is that if I remove the UPDATE portion of the stored procedure, everything works.

With UPDATE portion included, the error persits.

So I believe the SP is the source of the error which is why I am trying to obtain a new ID that will be used to related to other tables.

Hope this explanation helps.

Thank you very much.