.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

How To Insert Data from 1 table to Another Table

Posted By: Santosh     Posted Date: October 26, 2010    Points:2   Category :Sql Server
Hi All,

can any body plz tell me how to insert data from one table to another table without defining the column name...


Regards
Santosh

Responses
Author: Sajid P K             
Posted Date: October 26, 2010     Points: 5   

Hi,

INSERT INTO TABLEx
SELECT * FROM TABLEy



Regards,
Sajid P K

Author: Deco             
Posted Date: October 26, 2010     Points: 5   

SELECT * INTO Table2 FROM Table1

the above query will automatically create a table2 and will be filled with the data of table1

INSERT Table2
SELECT * FROM Table1

This will load the table1 values into the table2

Regards,
Deco
Author: Ramesh P             
Posted Date: October 30, 2010     Points: 5   

We can use two methods.

1. select * into table2 from table1

2. insert into table2 select * from table1

Second one is correct solution for this requirement. Because it will just insert the values from table1 to table2.

Regards,


Ramesh



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend