Views vs. UDFs vs. Stored Procedures for Data Warehouse Reports

  • imani_technology wrote:

    But could the same thing be done with a UDF?

    I'd say no. Not the same way as stored procedures. An inline UDF (heck, even a multi-statement UDF) are treated as tables (similar to views, hence the nickname, parameterized views) within T-SQL code. So not only is what is possible within a procedure vs. a UDF (or view) different, but the methods of calling them, maintaining them, and all the rest, is different.

    One is not objectively superior than the other. They are all tools in the toolbox that do different things in different ways for different reasons. Defining exactly what you need and why helps you define which of the combination of tools is best in a given scenario.

    TLDR: It depends.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply