I have a 7 queries that run based on a variable.... the variable can change several times...I want to add a loop to the query so it skips through each of the codes ...
Declare @Code as VARCHAR(3)
Declare @Month as VARCHAR(10)
Set @Month = 'Month 1' ............this stays in stone till the following month
Set @Code = 'AAA'
Now there is a table called tbl_test
that has a list of 7 codes, AAA, BBB, CCC, etc...
There are several Insert queries that are reliant on the @Code
So I want the SQL to loop through the tbl_test .....