• sarath.tata (4/14/2016)


    I totally agree with you. Initially they were all Stored Procedures. I changed them to functions as I can't really do EXEC in select query unless I write some complex logic of going through each row and capturing result in a temp table.

    I understand this is a performance hit using Scalar functions. These functions have a complex logic built-in using / interacting with multiple tables and producing a HTML in varchar to render on UI.

    I have decided to use this way as I will never have more than 10 rows in that table and not all of them would be executed at once as we have further filtering in that table to decide which user will have access to which Dashboard item.

    Do visit the article I linked to so that you can still take advantage of the functions like you want but with a whole lot better performance. Read the whole article so that you understand what a difference the simulated iSFs can make.

    --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)