How to copy or insert records into the previously created table from another table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shubham rastogi
    New Member
    • Dec 2010
    • 6

    #1

    How to copy or insert records into the previously created table from another table?

    hello guys I want to copy or insert records into the previously created table from another table..
    For example I have two tables A and B ....
    I want to copy or insert records from table B into table A ....

    But here is a little problem, table A has some records that I don't want to be overwritten by the records that are being copied or inserted from table A ....
    infact I want that all these records that are being copied from tabe B into table A should be seen after the previous records of table A ...


    consider the following example:

    following are two tables:

    table A table B
    --------- ---------

    id ename id ename
    --- ----- --- ------
    101 sam 103 rohit
    102 kan 104 alok



    and I want my records into table A like this:

    table A
    ---------
    id ename
    --- -----
    101 sam
    102 kan
    103 rohit
    104 alok
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Doing an INSERT statement will not overwrite your data on your target table. It will just appended into the target table. The sequence, however, will depend on the index of the table. If you have an index on the ID column, once inserted you will not be able to identify which records came from where unless you have a column that will indicate the source.

    Good Luck!!!

    ~~ CK

    Comment

    • shubham rastogi
      New Member
      • Dec 2010
      • 6

      #3
      could you please give any example to make it clear..

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Here are some sample commands.

        Good Luck!!!

        ~~ CK

        Comment

        Working...