Refactoring an INSERT statement into an UPDATE statement
Published 29 October 2019
SQL Prompt allows you to quickly and easily refactor INSERT statements into UPDATE statements, enabling you to update the data in your tables with a minimum of effort. This can be especially useful when dealing with tables containing large numbers of columns, as you don't have to spend time specifying them manually.
To refactor an INSERT statement, right click the INSERT statement and select the option Refactor INSERT into UPDATE... from the context menu. You can also use the keyboard shortcut Shift+Alt+F12 to trigger the refactoring.
The refactoring adds a default WHERE clause into the UPDATE statement, eliminating the risk of accidentally wiping all the data from a table. You can then customize this WHERE clause to suit your needs.
You can also refactor multiple INSERT statements in one go, by selecting them with the cursor and triggering the refactoring.