Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: Inserting from a Delimited String Parameter

    I want to pass the values in 2 parameters as follows and then do inserts from each value:

    @List1 varchar(100),
    @List2 varchar(100)

    @List1 = (1,2,3,4,5)
    @List2 = (20,25,30,50,60)

    I basically want to do an insert with each corresponding element in the list.

    i.e. While x < elements + 1
    Insert into Mytable (Value1, Value2) Values (List1-element x , List2-element x)

    My questions are: How do iterate though each List and do an insert based on each element? There will be equal number of elements in each list. Also, the numbers above have no relation to each other.

    Any examples would be great. By the way, the While above is just pseudocode for what i want - i am not familiar with the exact syntax.


  2. #2
    Join Date
    Feb 2002
    This article should help you:


    If not, please post back.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts