how to write a query to insert a row that is deleted from one table to another table using sql server 2000 at the same time

Recommended Answers

All 3 Replies

got the answer
insert table_name1(col1,col2,...) select col1,col2,... from table_name2

or
insert into table_name2
select col1,col2 from table_name1

what if the the table2 contains more/different columns than the table1 ?
you have to specify the column name
Your code will work if both the tabels are having same structure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.