I have a query which returns a column of ints, for each row, I want to call a stored procedure, how can this be done?
Let's say i have 'select my_key from my_table where cool=1' and it returns:
from that, i would like to automatically run
EXEC my_sp @p1=2
EXEC my_sp @p1=3
EXEC my_sp @p1=6
EXEC my_sp @p1=8
EXEC my_sp @p1=9
EXEC my_sp @p1=12
Can I do something like
EXEC my_sp @p1=(select my_key from my_table where cool=1) or is more complicated than that?
Assume that my_key and @p1 are both type int