Skip to main content
Clarity
Source Link
Sting
  • 2.8k
  • 12
  • 20

If I'm hearing what you're saying correctly, consider making your batch_id "match" an uploaded document by adding in your procedure something like:

declare @batch_id intuniqueidentifier 
select @batch_id = maxnewid(batch_id)+1 from main_table
insert into main_table (employee_id, name, email, ... batch_id) values (101,'Max Chan','[email protected]', @batch_id)
insert into main_table (employee_id, name, email, ... batch_id) values (102,'Next User','[email protected]', @batch_id)

That way, the batch_id will match the uploaded document. And, no batch_ids will be the same using the GUID approach.

If I'm hearing what you're saying correctly, consider making your batch_id "match" an uploaded document by adding in your procedure something like:

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)
insert into main_table (employee_id, name, email, ... batch_id) values (102,'Next User','[email protected]', @batch_id)

That way, the batch_id will match the uploaded document. And, no batch_ids will be the same.

If I'm hearing what you're saying correctly, consider making your batch_id "match" an uploaded document by adding in your procedure something like:

declare @batch_id uniqueidentifier 
select @batch_id = newid()
insert into main_table (employee_id, name, email, ... batch_id) values (101,'Max Chan','[email protected]', @batch_id)
insert into main_table (employee_id, name, email, ... batch_id) values (102,'Next User','[email protected]', @batch_id)

That way, the batch_id will match the uploaded document. And, no batch_ids will be the same using the GUID approach.

Clarity
Source Link
Sting
  • 2.8k
  • 12
  • 20

If I'm hearing what you're saying correctly, consider making your batch_id "match" an uploaded document by adding in your procedure something like:

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','m@g.com', @batch_id)
insert into main_table (employee_id, name, email, ... batch_id) values (102,'Next User','NextUser@g.com', @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. And, no batch_ids will be the same.

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.

If I'm hearing what you're saying correctly, consider making your batch_id "match" an uploaded document by adding in your procedure something like:

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','m@g.com', @batch_id)
insert into main_table (employee_id, name, email, ... batch_id) values (102,'Next User','NextUser@g.com', @batch_id)

That way, the batch_id will match the uploaded document. And, no batch_ids will be the same.

Source Link
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.