loop in function

  • Is it possible to write a loop in a function? I'm getting the following error:

    "Cannot access temporary tables from within a function"

    Is there a work around? :crazy:

  • Why do u want to do that? a function can be executed for each row, so why not use that directly ? Actually, can u elaborate on what u are looking for ?

  • Use table Variable instead of temp table

  • L09041975 (2/13/2011)


    Is it possible to write a loop in a function? I'm getting the following error:

    "Cannot access temporary tables from within a function"

    Is there a work around? :crazy:

    My recommendation would be for you to post the code your working on (along with a description of what it is supposed to do) even if it's not working correctely. If you post some readily consumable test data according to the article at the first link in my signature, you also stand a chance of getting some tested code as an answer to your post.

    --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 4 posts - 1 through 3 (of 3 total)

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