Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Multiple records

Status
Not open for further replies.

jmeckley

Programmer
Jul 15, 2002
5,269
US
How would I pass an array of values into a table? The array comes from a ASP page.

I know how to select multiple Items from one table and insert them into another, but I don't know how to do this with straight values. Is this a programming thing, or can TSQL do this?

The only thing I can think of is to create a temp table, individually insert each item of the array into the temp table and then create a batch insert statement to insert the rows from the temp table to the actaul table. But this seems like excess work.

Any ideas, or can it only be done individually?

Jason Meckley
Database Analyst
WITF
 
Have you tried just looping through the array, executing the INSERT for each element?

From instance

For iInt = 0 to ubound(arArray) - 1
'execute INSERT statement using arArray(iInt) value
next
 
that is currently what I have now, I was curious as to whether the list could be inserted with 1 statement as opposed to a loop of individual statments.

Thank you

Jason Meckley
Database Analyst
WITF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top