I am maintaining a function in SQL Server 2005, that based on an integer input parameter needs to call different functions e.g.
IF @rule_id = 1
-- execute function 1
ELSE IF @rule_id = 2
-- execute function 2
ELSE IF @rule_id = 3
... etc
The problem is that there are a fair few rules (about 100), and although the above is fairly readable, its performance isn't great. At the moment it's implemented as a series of IF's that do a binary-chop, which is much faster, but becomes fairly unpleasant to read and maintain. Any alternative ideas for something that performs well and is fairly maintainable?