Let's say I have a stored procedure:
exec my_sp ?,?
exec my_sp 'value 1','value 2'
1 | 2
exec my_sp 'aa','bb'
exec my_sp 'cc','dd'
The easiest way to do this (unfortunately) is via a
CURSOR. I renamed the columns you had in the question from
B for sanity's sake.
Declare @c_a varchar (10), @c_b varchar (10) Declare cur Cursor For ( Select A, B From YourTable ) Open cur While (1 = 1) Begin Fetch Next From cur Into @c_a, @c_b If (@@Fetch_Status <> 0) Break Execute my_sp @c_a, @c_b End Close cur Deallocate cur