Have you ever faced some situations where your database table's data are get updated or changed?
You have a backup database. You know you can use a backup database table to update the previous table data. But it takes more time to write update statement for each row.
You can use excel file to do that task easily as follow.
1.0 Generate the script from backup database. For example, I need to update 'is billable' columns of administrator table.
I write this query to get back up data.
SELECT aid,aisBillable FROM Administrator
2.0 Copy and Paste those query result into new excel file.
3.0 Use below SQL update function in the first row of the excel sheet as in the below image.
SQL:
="UPDATE Administrator set aisBillable ="&B2&" WHERE aid="&A2
4.0 Drag the first row to bottom rows. Then SQL 'Update' statement is updated as in the image.
5.0 You can copy those update queries and run on the SQL server to get updated table data.
Summary
Without writing an update/delete queries for each row, you can use excel functionality to make a job easier.
No comments:
Post a Comment