Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Location
    UK
    Posts
    40

    Unanswered: Pull down from one table and push up into another....

    Hi All,

    I have a problem,

    I need to copy a large amount of data from one table and insert it into another table.

    The design of the destination table is exactly the same as the source table except for the fact that it has one extra field.
    Can I copy; in a single SQL statement; all rows in one table (that match given criteria) into another table allowing for the extra field?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    What's "a large amount of data"?

    INSERT INTO myNewTable99(Col1, Col2, ect)
    SELECT Col1,Col2,ect
    FROM myOldTable99
    WHERE ....

    You could also create a view, bcp the data out then in....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Apr 2004
    Location
    UK
    Posts
    40
    OK - i see how that copies the old data across but what about the additional field?

  4. #4
    Join Date
    Apr 2004
    Location
    UK
    Posts
    40
    Oh and by a large amount of data i'm talking about 10,000 rows of data from a table of around 20 fields of various types.

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by Superfly1611
    OK - i see how that copies the old data across but what about the additional field?

    Just leave it out of the col list...unless it's not null

    Then either add a 0 or '' or '12/31/9999' depending on the data type in the SELECT

    and 10,000 is nothing....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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