Inserting 'n' rows into a table

  • Hi,

    I have a page that has a variable number of requests for sets of information

    (For example, user details:

    "How many people will be attending the conference?.....Ans: 12.... ok so on the next page display form entry details for 12 attendees." ...just an example!).

    I could cycle through the n number of records gathered sending the data as separate chunks n number of times to a usp, but I'd rather (I'm assuming that it'll run faster) send the whole lot to a single usp.

    Is this at all possible? Any help appreciated!

    (SQL server 2000, win 2000)

  • The only way I know you could accomplish that is setup a deliminator and pass all row details for every field item, so that you can identify the points to seperate the data. Then in the SP you would have to rip appart to make individual queries. However if someone throws a record in with the same deliminator you will hit an issue, or maybe the fields change, you have to work out the fine points in your SP. My suggestion is run each and use the ADO command object to build SP. Please use the no return mechanism. However you might loop thru and build a Dynamic batch string to submit and be executed by your SP, but all and all keep in mind also you cannot submit more than 8000 characters, so you will only be able to handle a finite number of record submissions at a time depending on data size.

  • Sounds like good advice to me, many thanks!

    Mike

  • One alternative method might be building an XML document with the required records, then executing an SP using OPENXML(). Just a thought...

  • Not something I've done before but I'm guessing it's not so difficult, I'll look into it, thanks also!

    Mike

    quote:


    One alternative method might be building an XML document with the required records, then executing an SP using OPENXML(). Just a thought...


Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply