I have the following tables:
Table_1
timestamp parameter value
---------------------------------------------------
2015-09-04 18:48:00.000 par01 1
2015-09-04 18:48:00.000 par02 2
2015-09-04 18:48:00.000 par03 3
2015-09-04 18:48:00.000 par04 4
2015-09-04 18:48:00.000 par05 5
2015-09-04 18:48:00.000 par06 6
Table_2
formulaID formula
---------------------------------------------------
1 (par01*par02)
2 (par03*par04)
3 (par05*par06)
I want to replace the values of the table_1 in the formulas of the table_2. Finally, execute the formula. What's the fastest way?
I know how execute the formulas with the following code:
DECLARE @sql VARCHAR(50)
SET @sql = '(2*2)'
EXEC('select ' + @sql)
AVG()AVG?AVG()in this case. Because formula is: ( par01 + par01 + par03 )/ 3. @Josep Is it correct formula?