Click here to Skip to main content
15,922,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table named tblManpowerCollection. I have to delete data from '01-10-2013' to '05-05-2013' and the date will get from "AttDate"
column of tblManpowerCollection and insert the deleted data into another table as backup. How can I do that using stored procedure. Please help me.
Posted

1 solution

Here a sample
SQL
CREATE PROCEDURE uspGetAddress
AS

INSERT INTO Table1_Backup(Column1, Column2) SELET Column1, Column2 FROM tblManpowerCollection WHERE DateColumn BETWEEN '01-10-2013' to '05-05-2013' --Insert records to backup table before delete

DELETE FROM Table1 WHERE DateColumn BETWEEN '01-10-2013' to '05-05-2013' --Delete records after backup

But careful with Date formats[^]. And I'd use UPDATE instead of DELETE[^]
 
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