Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Substituting Column values as Math function

$
0
0

Hi

  I have case while working in my stored proc  wherein based on the function id  ineed to

apply suitable mathematical functions on the metric table

Eg::for Metric id  value"1" the function look up table returns the sum function

for Metric id  value"2" the function look up table returns the avg function

and functions have to be placed dynamically

like

select sum(value)

select avg(value) based on the lookup id

How can i achieve the above

Function Look up

Id  Name

1    Sum

2    Avg

3    Max

Metric table

ID  Value  Function Lookup iD

1      10           1

1      100         1

2      4             2

2       8            2


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>