Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i insert row of table1 to table2 ..and after insertion delete that row from table1.
Posted
Comments
Ramya SV 10-Apr-13 1:31am    
Can you briefly explain the Question.
Karthik Harve 10-Apr-13 1:41am    
which table ? sql table or .net datatable ?
Raj@88 10-Apr-13 1:50am    
i hv two table in my project Advertise1,Advertise2...the project is related to Advertising the business, when user insert data related to their business data will save in Advertise1 ...with start date and end date after completion the date the data of the particular user should move from Advertise1 to Advertise2...for that am using access database.

1 solution

Here you can check
if your both tables having same defination means same number of columns and same data types
then you can go with
SQL
insert into table2
select * from table1 where id=1 --your condition here
delete from table1 where id=1 --your condition here

if your both table defination are different but the datatype of respected columns must be same
then you need to go for
SQL
insert into table2
select column1,column2,column3 from table1 where id=1 --your condition here
delete from table1 where id=1 --your condition here
--where column1,column2 and column3 are the columns you need to take from table1 which need to be inserted into table2



Thanks
Happy coding ;>)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900