Let's say that csv-like file is storing invoices and it looks like: (two schemas of csv file merged together)
InvID |Seller |Buyer |Date |Sum
1 |SomeSeller|SomeBuyer|2018-10-1|123.00
PositionNumber|ItemName|Quantity|Price
1 |Item1 |2 |10.00
2 |Item2 |1 |90.00
3 |Item3 |4 |23.00
InvID|Seller |Buyer |Date |Sum
2 |SomeSeller|SomeBuyer|2018-10-1|123.00
PositionNumber|ItemName|Quantity|Price
1 |Item1 |2 |10.00
2 |Item2 |1 |90.00
3 |Item3 |4 |23.00
InvID|Seller |Buyer |Date |Sum
3 |SomeSeller|SomeBuyer|2018-10-1|123.00
PositionNumber|ItemName|Quantity|Price
1 |Item1 |2 |10.00
2 |Item2 |1 |90.00
3 |Item3 |4 |23.00
What is the easiest way to achieve this? I was thinking about using cursor and sticking together the result for invoice header and invoice items and repeat it for every invoice but maybe there is some easier way to do this.
What is the correct way to get such a thing?
It has to be runned everyday. So there has to be possibility to attach it to sql server job