Table valued fucntion or scalar valued function

  • sqlfriends (11/7/2016)


    A further question, if function are not worked efficiently, why T_SQL has this table valued functions?

    In which case we should create functions?

    I can think of is for calculation, parse, and then code reuse.

    Same reason they have Cursors, the FORMAT function (44 times slower that Cast/Converrt), the newer Date/Time datatypes, the PIVOT operator, HierarchyID, recursive CTEs that count, etc, etc... mostly marketing.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing post 16 (of 16 total)

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