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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to insert multiple records i

Status
Not open for further replies.

cjkenworthy

Programmer
Sep 13, 2002
237
GB
I need to insert multiple records into a table with identical values except for one field . The table is of schema:

(sale_id, NGN_number, customer_id, date_of_sale)

The sale_id comes from a form on a web page, as does date_of_sale and customer_id and are fixed. The only value to alter is NGN_number. So basically I need to insert idential values for sale_id, customer_id and date_of_sale for as many records as there are number of NGN_number's. The number of NGN_number values is dependant on how many the user has chosen.

How would I do this with SQL? An example of new records:

(1, 08456441234, 1, 17/09/02)
(1, 08701227711, 1, 17/09/02)
(1, 08450982222, 1, 17/09/02)
(1, 08702288199, 1, 17/09/02)
(1, 08792331480, 1, 17/09/02)
etc...

Using (sale_id, NGN_number, customer_id, date_of_sale)

I am using ASP and VBScript to insert into an SQL Server 7.0 database. Using Dreamweaver UltraDev 4 also. The NGN_numbers are in a repeat region, all other fields are automatically assigned to fields on the form.

How do i automatically repeat the SQL to insert the identical values for each records, with only the NGN_number changing for each record?

Thanks for any help, it will be greatly appreciated!

Chris
 
you could do a FOR NEXT or DO LOOP in the VBSCRIPT to insert.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top