I am hoping for some advice on the best way to achieve inserting numbers into rows and automatically increasing their sequence. I am using SQL Server 2014 I know there is the sequence object. I've played with temp tables and what not, but I'm just having trouble wrapping my mind around this. Below is the data I'm working with:
Table1: OrderList
Column: LineNumber
Table2: WatchList
Column: LineNumber
The LineNumber in the OrderList table is automatically generated by another system and results in numbers by 10k. So, 10000,20000,30000.
The data from the orderlist updates into the watchlist table. Then new rows are added, but the LineNumber is not. So in the WatchList table it looks like:
Item / LineNumber / xzy
134 10000 blah blah
1432 20000 blah blah blah
433 NULL blah blah
839 NULL blah blah
What I want to do is run an update to populate 30000 and 40000 into those null fields and I'm honestly not sure the best way to do it.
If you have some advice or a direction on which path would be best to take, I'd appreciate it.