Skip to main content
1 of 3
Sting
  • 2.8k
  • 12
  • 20

If I'm hearing what you're saying correctly, consider adding in your procedure

declare @batch_id int
select @batch_id = max(batch_id)+1 from main_table
insert into main_table (employee_id, name, email, ... batch_id) values (101,'Max Chan','[email protected]', @batch_id)

from the main table and use that new/same value for all the records that stored proc will be inserting. That way, the batch_id will match the uploaded document.

Sting
  • 2.8k
  • 12
  • 20