Create stored procedure help

  • Hi ,

    I have to create a stored procedure which can have the following input paramter

    userId

    param1

    param2

    .

    .

    param13

    Param1,param2,param3... are descriptions which user with userid would have selected.

    Out of the 13 descriptions user will select max 3 or 4 .Its very rare user selecting more than 5.For each description I have to add a row in a Table .

    The table desction for table A

    id

    userid

    description

    here the description is the params.There will be multiple rows corresponding to a userid if a user selected more than one description.

    I am not sure whether I need all the 13 params or How do i handle this scenario.

    Please help me

    Thanks,

  • I would either use a varchar(8000) variable and a comma delimited list (or any delimiter that will never ever be part of the parameter) and split it in the sproc using the split string function referenced in my signature or I would look into a table variable as a parameter (assuming you're on SS2K8).



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

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

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