Results 1 to 15 of 15
Thread: dynamic query
Oct 25, 2012, 07:01 #1
- Join Date
- Dec 2009
- 0 Post(s)
- 0 Thread(s)
I have a database table month_values
this table has 12 columns...... columns are jan , feb , march , .....decm.
I have data values for each months.
I'm writing store procedure. I want to sum values between any two input month columns.
Example Input :
output for the above stored procedure should be sum values for month columns feb,march,april,may,june,july,aug,sept.
my problem is ...As you can see this is going to be dynamic query....because we may pass any two month columns to the store procedure input.
Can you please suggest how to build dynamic query here based on input selection ?
Do I need to use a CASE here ? how do I proceed ?