.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 >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

copying data from one table to another table

Posted By: Naresh     Posted Date: August 19, 2010    Points:2   Category :ASP.Net
Hi All,

There will be four tables in database(week1,week2,week3,week4).
i am uploading data from excel to database.Everytime i uplaod data from excel it should be copied to fourth table.

Intially 4 tables will be empty.when i upload first excel file data it should be copied to fourth table.When i select next excel file fourth table data should be copied to 3rd table and new file should be uploaded to fourth table.similarly when i select 3rd excel file it should be inserted to 4th table and 4th table data to 3rd table,3rd table data to 2nd table.


Responses
Author: Amit Mehra             
Posted Date: January 30, 2011     Points: 5   

Hi,

You can use the below SQL query to save data from one table to another

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.

Ref: http://www.geekinterview.com/question_details/57739

Thanks,
Amit
Please "Mark As Answer " if this post help you.


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