locked
How to insert Multiple rows in one Select Statement in Sqlserver2008 RRS feed

  • General discussion

  • Hi All,

    I need to insert   Multiple rows in one Select Statement in Sqlserver2008.

    Eg:

    Create table Temp(id int, Name varchar(200),number int)

    In Stored prodecure passing Parameters are

    @id=1,@Name='Raj', phonenumber='10,11,23'

     i need O/p will be:

    id   Name Number

    1    Raj     10

    1   Raj      11

    1  Raj       23

    Regards

    T. Rajesh Kumar

    Saturday, February 11, 2012 2:34 PM

All replies

  • you need to parse the comma separated string

    getting the count of elements

    loop through that count

    implement insert within the loop


    Ahmed ElSangary

    Tuesday, February 21, 2012 3:45 PM