Use Macros to record a series of keyboard commands in the Editor that can be played back multiple times. This is useful for reducing the amount of manual typing you have to do.
You have an INSERT statement with 500 lines of data to insert in the Directors table of the MOVIES database. Before executing the script, a new policy is created to change the order of two columns from LastName, FirstName to FirstName, LastName. Using Macros, you can record the keystroke actions to switch the order of the data values to FirstName and LastName for the first line; and can then press CTRL+SHIFT+P to play the macro and switch the order for the remaining 499 lines.
To create a macro for this example
Place the cursor at the beginning of the first row.
Press CTRL+SHIFT+R to begin recording the macro.
Press CTRL+SHIFT+RIGHT to select the value for LastName in the first row.
Press CTRL+X to remove the LastName.
Press DELETE to remove the comma.
Press END to move to the end of the line.
Press ”,” to add a comma.
Press CTRL+V to paste the LastName after the FirstName.
Press HOME to return to the start of the line.
Press DOWN to move to the next line.
Press CTRL+SHIFT+R to stop recording.
Press CTRL+SHIFT+P to play the macro.