The SQL language offers a simple and effective way to quickly move all records from a table to another table with same field structure, that is same fields' name, type and position:
INSERT Customers SELECT * FROM New_Customers -- you can optionally complete the move by -- deleting all records in the source table DELETE New_Customers
If the fields have different names, or if the target tables doesn't include all the fields in the source table, you must provide a field list:
INSERT Customers (Name, Address, City, Nation) VALUES SELECT Name, Address, City, Country FROM New_Customers
If fields also have a different type in the two tables, you must convert data on the fly using the CONVERT() function.
|
| Author: Sankaranarayanan.M 26 Jul 2004 | Member Level: Bronze Points : 0 |
the way u proposed is the most effective way. and another way is to just go for Select * into NEWtbl from OLDtbl.
this is another way of moving records from one table to other with the same structure.But the only disadvantage in this command is it takes time to execute. Thankz for u . SankarM
|
| Author: Sankaranarayanan.M 07 Aug 2004 | Member Level: Bronze Points : 0 |
What happens to the execution time.if u insert millions of records into a table which already having millions of records. Plz anwser me. i'm in great need for it. Thankz
|