Append data to a table

Results 1 to 2 of 2

Thread: Append data to a table

  1. #1
    Join Date
    Dec 1969

    Default Append data to a table

    I see many examples of loading a dataset, modifying it, and then updating the changes using and things like the dataadapter. What I want to do is take a dataset and append the records to a table. Is this possible?<BR><BR>I have a windows web service that accepts a dataset as a parameter and I would then like to append to a db using this dataset. How would I do this? I am trying to avoid looping through the records one by one and calling INSERT INTO sql statements.

  2. #2
    Join Date
    Dec 1969

    Default Yes...not hard...

    Except you *do* still use INSERT, because there&#039;s no such thing as "ordering" in a relational DB [except in a SELECT when you specify ORDER BY], so all additional data is considered to be INSERTed.<BR><BR>INSERT INTO maintable (field1, field2, field3)<BR> SELECT fieldX, fieldY, fieldZ <BR> FROM table_to_append<BR> IN ...external database specification...<BR><BR>Simple as that. One SQL statement, all data inserted.<BR><BR>Of course, you need to make the dataset *LOOK* like a valid database (could even be a "text" database) and the actual format of what you use for the IN clause depends on both that and what kind of DB the main database is.<BR><BR>None of which you told us. So this is as far as I can go.<BR><BR>

Posting Permissions

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