Stored procedure doesn't insert data into one of the table even though data looks good

Viewed 43

I'm trying to insert data into two tables [Product]., it's inserting into one of the tables not inserting `[Product]. It returns an empty table. Not sure how to handle multiple inserts in the stored procedure:

1 Answers

Try this

 INSERT INTO [Product].[LKStandardProductGroup]
([StandardProductGroupID],[StandardProductID])
 SELECT      
       @StandardProductGroupID as [StandardProductGroupID] ,
       value as [StandardProductID] 
    FROM        STRING_SPLIT(@StandardProductCodes,',') inp
    INNER JOIN  [Product].[StandardProduct] sp WITH(NOLOCK)
    ON          sp.[StandardProductID] = inp.value
Related