I'm analyzing a fellow developer's SQL code and I could be totally wrong, but something they've done doesn't seem good to me.
The design is for a dynamic expression builder. The expressions are stored using a few tables and the system works. The aspect of the system that concerns me is that when the expression records are stored, a stored procedure is called that then creates a UDF that unrolls the entire expression as one function.
So what that means is, for each unique expression created, there will be a unique UDF that can be ran that will execute that expression. I'm assuming that this is being done so that the execution plan can be cached and performance will be increased, as opposed to building dynamic sql and running that each time.
What do you guys think, does it seem like an acceptable solution? Do you need more info?