I need to increment by 1 for each record added. There are over 60,000 records I need to add. Any suggestions?
If I do this
INSERT INTO PRODUCTSBYCATEGORY(productid, categoryid, sequence)
(Select productid, 8, (select (max(sequence) + 1)
from productsbycategory
where categoryid = 8)
from product
where (partnumber not like 'ITE%') and
(partnumber not like 'NPO%') and
(partnumber not like 'ENG%')
It will set the sequence to 2, but then it set all records to 2, instead of 3, 4, 5, etc.
If I do this
INSERT INTO PRODUCTSBYCATEGORY(productid, categoryid, sequence)
(Select productid, 8, (select (max(sequence) + 1)
from productsbycategory
where categoryid = 8)
from product
where (partnumber not like 'ITE%') and
(partnumber not like 'NPO%') and
(partnumber not like 'ENG%')
It will set the sequence to 2, but then it set all records to 2, instead of 3, 4, 5, etc.