I have some UDFs that I am trying to clean up that use a series of IF
statements to return the status of something in real time.
These functions all start off by declaring 15-20 variables (varchars, ints), selecting values into them, then cycles through the IF statements.
Would there be a benefit to storing the values in a temp table or table var versus creating, populating and referencing all of these variables?
Update
The UDFs currently in existence are actually scalar functions built by another developer, no longer with the project. The variables are populated from a single select with an average of 5 joins. I have inherited about 10 of these functions. Some reports hit two or more of them, and some times the same function is hit once in the select statement and again in the where clause.