Hi @rabi shakeel
Check this:
CREATE TABLE #Probale (prdno INT,orderno int,CodeItem int,Weigth int,prdqty int,EntryDate date,DelID int,PID int)
INSERT INTO #Probale VALUES(10000,15,10,270,1,'2020-10-21',null,111)
Create table #tbl_PckDetail (DID int, prdno int,Qty int ,delid int)
;WITH CTE AS
(
SELECT 1 AS DID,Prdno,prdqty AS QTY,DelID
FROM #Probale
WHERE prdqty =1
UNION ALL
SELECT DID+1 AS DID,Prdno,QTY,DelID
FROM CTE
WHERE DID<10
)
INSERT INTO #tbl_PckDetail
SELECT * FROM CTE
SELECT * FROM #tbl_PckDetail
You can also find solutions from other experts in this thread:Insert Multiple Row into Table
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.