# SQL- Inserting multiple records

**URL:** https://forum.kirupa.com/t/sql-inserting-multiple-records/222855
**Category:** programming
**Created:** [April 17, 2007, 3:17pm UTC](https://forum.kirupa.com/t/sql-inserting-multiple-records/222855 "2007-04-17T15:17:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)
#### Post date: [April 17, 2007, 3:17pm UTC](https://forum.kirupa.com/t/sql-inserting-multiple-records/222855/1 "2007-04-17T15:17:02Z")

</div>

What I need to do is insert multiple records into a table.

The table is set up something like

ID  
FirstName  
LastName  
Company

Then I have an array with a variable amount of records.

For example  
John  
Doe  
Msoft

Jane  
Doe  
Msoft

etc…

The user chooses what to name there columns so I’m using an additional array so my INSERT statement looks something like

```auto

SQL = "INSERT INTO MailingList (ShopCartID, "&split_location(0)&", "&split_location(1)&", "&split_location(2)&", "&split_location(3)&", "&split_location(4)&", "&split_location(5)&", "&split_location(6)&") Values ('"&ShopCartID&"', '"&total_split_text(0)&"', '"&total_split_text(1)&"', '"&total_split_text(2)&"', '"&total_split_text(3)&"', '"&total_split_text(4)&"', '"&total_split_text(5)&"', '"&total_split_text(6)&"')"

```

Now this works fine but only for 1 record. What I need to do is somehow loop this - I’ve read stored procedures is a good option but I really don’t know anything about them. I’m hoping I’m just overcomplicating this.

Thanks in advance.
