I'm making a stored procedure in SQL to work in some C# code I'm doing. The stored procedure's job is to find all rows in a table in which another table's ID exists, then get some column values for those selected rows, followed by inputting new data into the table using the same values I just selected. In anything but SQL, I would probably use a for loop to do this (because the initial select statement is returning multiple values, and I need to do something different for each value returned), but from my research online, it seems that a for loop in SQL is not gonna happen. What is the best way to do this?
Comment