DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Query to Copy data from one table to other

  1. #1
    Kshipra Guest

    Query to Copy data from one table to other


    Hi,
    I want to append records from one table to other table through
    SQL query.


  2. #2
    Suresh Guest

    Re: Query to Copy data from one table to other


    An easier way to reference the records in both tables would be to create a
    VIEW with a union of both tables. For example, if you have table A and table
    B you could use:

    CREATE VIEW Z
    SELECT * FROM A
    UNION
    SELECT * FROM B

    The new view Z can be referenced like any other table.
    This avoids having to actually copy the records from one table to another.


    Regards,
    Suresh

    "Kshipra" <KshipraRB@hotmail.com> wrote:
    >
    >Hi,
    > I want to append records from one table to other table through
    > SQL query.
    >



  3. #3
    Michael Levy Guest

    Re: Query to Copy data from one table to other

    You can use the INSERT statement with a SELECT.

    INSERT INTO x (a, b, c)
    SELECT d,e,f
    FROM y

    -Mike
    --
    Michael Levy MCDBA, MCSD, MCT
    michaell@gasullivan.com



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center