Saturday, June 9, 2012

copying data from one table to another table

Insert into <destination table name> select * from <source Name>
ex:
insert into Emp_History select * from Employee.

Here 2 tables must be exists.

Create a table from another table 


select * into <newtable> from <old table>re  [where condition]

ex:
Create new table from existing table along with same data

select * into emp_backup from emp;

Create only structure from the existing table

select * into newemp from emp where 1=2;


No comments:

Post a Comment