i have 2 tables. One is Order header the other one is order lines. Order header:
OrderID Customer IntegrationID(Identity auto Incremental)
Order lines :
OrderID Itemid IntegrationID
The thing i want to do: i run a stored procedure which populates these 2 tables with data and i want the order line to have the same IntegrationID as the order header. For example when i insert to order header:
OrderID Customer IntegrationID(Identity auto Incremental)
500 5 1
501 4 2
And in the order lines i want to have the data like this:
OrderID Itemid IntegrationID
500 101 1
500 102 1
501 102 2
Any ideas how can i achieve that? Orderheader and orderlines are linked via ORDERID field.