EXECUTE stored procedure question

  • I want to know if and how I would EXECUTE a stored procedure where one of the parameters I can put in multiple id like below. I want to put multiple id's where it says 'v_intGroupID =' Is that possible to do that where it says 'v_intGroupID = 136064, 122244, 122222', etc.

    USE [TESales]

    GO

    DECLARE@return_value int,

    @o_bitErrorFound bit

    EXEC@return_value = [dbo].[prGroup_delGroup]

    @v_intGroupID = 136064,

    @v_intChangeUserID = 386631,

    @v_strChangeRole = N'0A',

    @v_intChangeGroupID = 24870,

    @o_bitErrorFound = @o_bitErrorFound OUTPUT

    SELECT@o_bitErrorFound as N'@o_bitErrorFound'

    SELECT'Return Value' = @return_value

    GO

  • One of the things I have seen done is pass it in as a string with all the values seperated by commas and have the procedure either parse it accordingly, use it with the 'where columnid in (@variableid)' or for a larger number of values have a table function parse it and return as a table that can be indexed and used inside the function for better performance.

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

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