You want to get the data of the items from the db using the ids. You have a stored procedure that takes an id and gives you a single row with the data.
Call query to get ids.
Loop each id and call the stored procedure given an id.
Would writing a new stored procedure to do this in one transaction be considered premature optimization?
Powered by IDERA