parameter

  • How can I get the parameter value in my inner StoreProc.

    I have SP1 which has a parameter x and another store proc SP2 which is executed in SP1. How can i capture x in SP2.

  • A parameter's scope is only good for the stored procedure that it is passed into.  It has the same scope as a local variable.  The only way to get it into SP2 is to pass it in as a parameter to SP2.  If you expect SP2 to be able to change the value of x, the only way SP1 will 'see' that new value would be to pass x back to SP1 as an output parameter.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • It may be worth using a temp table to store your paramter in.  It's probably not the most efficient or elegant method but it works which is the main thing.

    If you liked Johns method of passing paramters using the output parameter command or my own suggestion of temp tables then a good place to go for examples and more methods is

    http://www.sommarskog.se/share_data.html

    It's my first time on this forum so I hope I've been of help

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

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