How to insert one to many valued parameters from a stored procedure into a table

  • Hi,

    I have a SP with Parameters as:

    R_ID

    P1

    P2

    P3

    P4

    P5

    I need to insert into a table as below:

    R_ID P1

    R_ID P2

    R_ID P3

    R_ID P4

    R_ID P5

    How can I get this?

    Pls help.

    Thanks for your time and help.

  • Just something like this?

    declare @RID int, @p1 int, @p2 int, @p3 int, @p4 int, @p5 int

    declare @targetTable table

    (

    _key int,

    _value int

    )

    insert into @targetTable (_key, _value)

    values

    (@rid,@p1),

    (@rid,@p2),

    (@rid,@p3),

    (@rid,@p4),

    (@rid,@p5)

    Executive Junior Cowboy Developer, Esq.[/url]

  • Thank you!

    I will try it.

    Rgds

    Gayesh

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

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