|
|
|
|
|
by SigmundA
2406 days ago
|
|
> Sql function:sorry but they are most often crap and useless, better to in-line or use TVF, and no its not code logic duplication. Functions have helped me tremendously in SQL server, but you do have to know the issues, which can be taken advantage of to some degree. Code reuse is the obvious use case, but due to lack of inlining up to SQL Server 2019 meant you could reduce performance compared to hand inlined case statement or whatever. Hopefully now that functions can be inlined in 2019 this will be a non issue going forward They are an optimization barrier which can be a good thing. I have used to this my advantage to stabilize tricky queries that where using views for code reuse. The performance becomes consistent and predictable rather than going pathological on some databases even though it may be slightly slower on others. |
|