GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  SQL Server
Go To First  |  Previous Question  |  Next Question 
 SQL Server  |  Question 31 of 68    Print  
How to copy one table data into another table directly?

  
Total Answers and Comments: 3 Last Update: August 25, 2008     Asked by: penchal 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: srivani123
 
select into statement will work here

syntax: select column1,column2,....
into table2
from table1

Above answer was rated as good by the following members:
pankajalld06
October 12, 2007 06:14:13   #1  
chandra        

RE: How to copy one table data into another table dire...
Syntax to copy the structure of the one table into another table.

syn: select * into newtablename from oldtablename where false condition

ex: select * into dept1 from dept where 1 9

sytanx to copy one table data into another table.

syn: insert into newtable name select * from old tablename

ex: insert into dept1 select * from dept.

 
Is this answer useful? Yes | No
November 15, 2007 00:40:00   #2  
srivani123 Member Since: November 2007   Contribution: 9    

RE: How to copy one table data into another table dire...
select into statement will work here

syntax: select column1 column2 ....
into table2
from table1

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 25, 2008 01:06:38   #3  
sakthi.jaganathan Member Since: August 2008   Contribution: 8    

RE: How to copy one table data into another table directly?
We can copy the Table structure also from one table to another table

Example:
CREATE table emp1 as
SELECT * from emp
WHERE 1 2;

we can copy a data from one table to another table

While copying the data we should be careful in few things

1. Both the table Structure should be same

2. The DataType of all the Columns of the both table should be same

Example:

INSERT INTO emp1 VALUES as
SELECT *
FROM emp




 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape