Calling SP in from/where clause

  • hi,

    Is there any way to call a stored procedure in where clause on in select --- from clause ??

     

  • I suppose there's a way... but, instead, I normally create a temp table with the results of the called proc and then just join to the temp table.

    Create the temp table with the necessary columns.  Then...

    INSERT INTO #temptable (Collist..)

    EXEC storedproc

    If we knew more about what you were trying to do, there may be a better solution such as a table variable function, etc.

    --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)
    Intro to Tally Tables and Functions

  • we can use openquery or openrowset to do so.

    Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

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