How to get inputer parameter value inside the stored procedure

  • Hi,

    I have stored procedure having one input parameter .

    ALTER PROCEDURE [dbo].[CMT_RoomDelete]

    @pRoomId INT,

    AS

    BEGIN

    UPDATE CMT_Rooms SET IsActive = 0 WHERE RoomID = @pRoomId

    END

    I want to get the input parameter value for @pRoomId inside the SP. I can simply get using select @pRoomId. But my requirement is different.I am using this following sql statement

    select name from sys.parameters where object_id in (select object_id from sys.procedures where name = 'CMT_RoomDelete')

    But this will return only @pRoomId. I want to get the value for this ouput (@pRoomId).

    Pls help me to find out it.

  • Could you please clarify your question? What do you mean by "get" parameter? Get for what purpose?

    If you want to display it for debug purpose you may use "print(@myParam)", or "select @myParam".

    If you want to use it in some statements - just use it, as it is written in your code "...where myField=@myParam..."


    I am really sorry for my poor gramma. And I hope that value of my answers will outweigh the harm for your eyes.
    Blog: http://somewheresomehow.ru[/url]
    Twitter: @SomewereSomehow

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

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