T-SQL User-Defined Functions: the good, the bad, and the ugly (part 4)
9 Comments
Scalar user-defined functions are bad for performance. I already showed that for T-SQL scalar user-defined functions without and with data access, and for most CLR scalar user-defined functions without data access, and in this blog post I will show that CLR scalar user-defined functions with data access fit into that picture. First attempt Sticking to my simplistic example of finding the triple of an integer value by reading it from a pre-populated lookup table and following the standard recommendations and templates that Microsoft publishes for CLR scalar table-valued functions, my first attempt for this function looked like this: [Microsoft.SqlServer.Server.SqlFunction(DataAccess=DataAccessKind.Read, …