I want to move data from one table to another with same database using a stored procedure.
Each time stored procedure executes only updated columns are copied from one table to other in SQL Server.
I want to move data from one table to another with same database using a stored procedure.
Each time stored procedure executes only updated columns are copied from one table to other in SQL Server.
You can achieve this using audit columns.
On the source table you need to add a ModifiedOn datetime column. Any time a column is updated on the source table you also need to update the ModifiedOn column to getdate() to designate that row has been modified and a column value has been updated.
When you copy data from the source table to the destination table, if you keep track of the last ModifiedOn value you loaded to the destination table you can use that value to find rows on the source table that have a larger ModifiedOn value and then only load the rows that have had changes.