need table returning function with input table name as parameter

  • Jeff Moden (11/19/2014)


    I don't believe "the kludge" allows you to pass parameters to a stored procedure in a function. To do that, I believe that you still need dynamice SQL.

    Jeff to the rescue again!!! I believe you correct yet again good sir. It does seem that either a stored proc or a CLR is about the only to do this.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (11/19/2014)


    Jeff Moden (11/19/2014)


    I don't believe "the kludge" allows you to pass parameters to a stored procedure in a function. To do that, I believe that you still need dynamice SQL.

    Jeff to the rescue again!!! I believe you correct yet again good sir. It does seem that either a stored proc or a CLR is about the only to do this.

    Right - you can get the EXEC to happen, but no params thanks to OPENQUERY. Nice catch indeed.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • I was kidding about the inner circle. I understand your reservations. That's why I included the comment about learning to code sql out of a cracker jax box.

  • DSNOSPAM (11/19/2014)


    I was kidding about the inner circle. I understand your reservations. That's why I included the comment about learning to code sql out of a cracker jax box.

    Heh... 😀 It's OK! You're "IN". A lot of people think the decoder ring is edible and use a hammer to open the box of Cracker Jax. 😛

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

  • I use the hammer on my keyboard to do the coding. that's what it said to do in the cracker jax box.

    They also had a little bell in there. They said hang it around my neck so people would know I'm coming.

    Did someone mention thinking outside the box?

Viewing 5 posts - 16 through 19 (of 19 total)

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