3 ms·
Have you used T-SQL's "CROSS APPLY" or "OUTER APPLY" in conjunction with encapsulated views or table-valued functions? You might want to have a look at that as
by ak39 9y ago
Have you used T-SQL's "CROSS APPLY" or "OUTER APPLY" in conjunction with encapsulated views or table-valued functions?
You might want to have a look at that as a significant enabler of code reuse on SQL Server.
(On PgSQL is LATERAL JOIN)
(Ps: you should try to replace SCALAR functions with SET-BASED logic. These can easily be ringfenced into TVF)
- Pxtl 9y agoTVFs are intensely verbose to use compared to the corresponding SVF for a single column. Cross Apply will destroy your performance. I'm venting because I've watched clean, legible code get destroyed into soup of a zillion tiny joins and endless repeated boilerplate for performance improvement by this misfeature.