I am new to SQL Server, I am trying to do something as follows.
Sample code :
SELECT ITEM_ID FROM \'TABLE_NAME_1\' WHERE ITEM_STATUS = \'ACTIVE\' SET @I
Question would be why not use a straight SQL
INSERT INTO 'TABLE_NAME_3' (ITEM_ID ,PRICE ) SELECT ITEM_ID,ITEM_PRICE FROM 'TABLE_NAME_1' A JOIN 'TABLE_NAME_2' B ON A.ITEM_ID=B.PRODUCT_ID WHERE A.ITEM_STATUS = 'ACTIVE'