udit99
Materials
- Jan 2, 2007
- 2
I want to iterate through a list of key values and run SQL in each iteration based on that value but im not sure how to use the for loop in SQL. Something like this:
declare @test numeric(9)
for @test in (134424,134423,134425)
select count(*) from test_table where test_id=@test
next
declare @test numeric(9)
for @test in (134424,134423,134425)
select count(*) from test_table where test_id=@test
next