I have a stored procedure that I have scaled down considerably for the purpose of this question but in essence the issue I need assistance with is this.
If a row in tab
See the changes:
-- this does not work for multiple IDs
SELECT @IPV_ID_Found = @IPV_ID_Found + ',' + (CAST(@IPV_ID AS VARCHAR(500)))
then you will get a concatenated list of values, like 1,2,3,4,5
BUT if you need to return a recordset, then you need not OUTPUT parameter, use the table variable instead:
declare @IPV_ID_Found table(Item varchar(500))
IF (@IPV_Status ='closed')
BEGIN
UPDATE TEST_TBL
SET
Status = 'xyz',
WHERE
ID = @IPV_ID
-- this works for one ID
insert @IPV_ID_Found
VALUES (CAST(@IPV_ID AS VARCHAR(500)))
-- this does not work for multiple IDs
INSERT @IPV_ID_Found
VALUES (CAST(@IPV_ID AS VARCHAR(500)))
SELECT Item FROM @IPV_ID_Found
END