Say I have a table containing a list of orders like this

P/O Barcode Ctn/Qty
ADCD 374777579 100
ABCD 374777581 50
DEFG 374777579 200
DEFG 374777581 150

This table says that for each order I have a barcode that will appear to be the same on each of the
100, 50,... cartons. This normal.

What I want to do is for each order and barcode I want to add an extrat unique identity plate.
Therefore if I have 100 cartons on the first line I will create 100 different identity plates, one per carton.

Then my table will become like this

P/O Barcode Ctn/Qty IdPlate
ADCD 374777579 100 0000001
ADCD 374777579 100 0000002
ADCD 374777579 100 0000003
....

How can I code this in SQL? Should I create a stored procedure with the For Each... Next command?
Any idea how to proceed.

Best regards.

Pascal