I have a table,
accounts, which contains the vast majority of the data I am concerned with.
accountTypes contains different types of accounts (Business, Personal, etc.). I want to perform calculations on each row of
accounts based on the
accountType. The best method I can think of for doing this would be to create UDFs, then store the names of the UDFs in a table
typeFunctions, consisting of rows of
functionName, as in:
P, "f_ageOfAccount" and
Unfortunately, joining this table to the accounts table and looping through it to
exec the function name seems very kludgy.
Is there a better way to approach this problem?
Context: Currently, the legacy version of this application stores ad hoc SQL in
typeFunctions and execs the SQL, looping through the accounts with a cursor. Obviously, this has some performance implications and is not optimal when dealing with complex calculations.