All parameters in SP

  • Hi,

    Need help here!!!

    Have a SP that runs a few imports ect ect.... Now i need to do error handling....

    Is there a table or a view that contains info of all @variables inside the sp?

    e.g:

    Create Proc Test

    as

    Declare @test1 varchar(10)

    Declare @Test2 varchar(10)

    Declare @Test3 varchar(10)

    SET all parameter to something!!

     

    Now I need something like this:

     

    select Name , value

    from "all_varialble _inside_myproc"

    for error handling....

     

    Any suggestions?

     

    Thanks a mil

    Eric.


    Regards,

    Eric Rautenbach

  • Hi Eric,

    Unfortunately there isn't any table that tells you what variables have been declare inside the sp. You can find the variables that have been declare as part of the sp from syscolumns.

    e.g. select name from syscolumns where id = object_id('name of sp').

    You could parse the text of the sp, which you can get from syscomments. Seems more trouble than it's worth though.

    Can I ask what type of error handling you want to do that requires getting a list of the variables declared in your sp?

    Regards,

  • Hi Karl,

    Thanks for the reply, was hoping for a answer!!!

    We are using "from OpenXml" queries, and our developers are building the messages that we get into the proc's from data islands... So the messages don't always contain data... This make the inserts and update tricky!!

    We have a e-mail function that we invoke if we encounter any errors in the procs, but I now want to include all values of current parameters at time of error... does this make any sence? hehe..

    I can make this happen by hard coding all values and parameters, but would like to make it dynamic.!

    Will let you know if I find anything??!

    Cheers,

    Eric.


    Regards,

    Eric Rautenbach

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

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