I have a Table of Items which has some columns [Id], [ItemOrdinal], [Amount], [Qty]
[ItemOrdinal] is an integer that basically represents an embedded Id from the imported file.
This table is data translated from a file which has fields like Item1Amt.
The problem I have is a legacy system will need to access the data as if it is looking at the old system.
So I would like to be able to return a view - I have been reading about CTE's and Pivot tables, my thought is more in line with a CTE where basically I create the columns in the view and insert into them
How can I get a result set with columns named like this Item[ItemOrdinal]Amt, Item[ItemOrdinal]Qty preferably in a View typically the max number of rows will be 8 rows?
Item1Amt, Item1Qty, Item2Amt, Item2Qty, ...Item8Amt, Item8Qty
I am looking at the answer here^
DB Fiddle Example of the tables Table 2 of the examples in particular