I am trying to create labels based on a batches quantity. I have the query mostly compete except I can not figure out how to create multiple rows of the same data based on the number value in a column. I need the query to select from my temp table I've created the BatchID number and then generated rows based on the number value in the items column for create the duplicate rows in order to generate the labels. This is the query I have so far.
CREATE TABLE #Temp_Table
INSERT INTO #Temp_Table
FROM tblIL_BtcBatches b,
b.fstrBatchId = '1514021901'
and L.LocationNumber = '219'
Select ROW_NUMBER() over (Partition by Batch_Item_Count order by Batch_Item_Count) AS Doc#,
BatchID AS BatchID From #Temp_Table
DROP TABLE #Temp_Table