Hi everyone, please help me with this....
How can I move all the records more than 10days from main table to another table every day
How can I move all the records more than 10days from main table to ano
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Jignesh KumarRank #91 · 22.9K reputationPosted Oct 16, 2022, 12:15 AM EDT
Hello,
you can create shedular task which runs every day. In that task you can write your logic to insert data into another table from main table and you can delete data from main table. Please refer below script which may help you to do that
Begin Transaction Insert into AnotherTableName (field1, field 2......) SELECT (field1, field2......) FROM MainTableName WHERE DT_INSERT >= DATEADD(DAY, -10, GETDATE()); Delete FROM MainTableName WHERE DT_INSERT >= DATEADD(DAY, -10, GETDATE()); Commit;