Just a quick SQL tip that I have been using recently, and is aimed mainly at MS SQL, but I cant see any reason why this wouldn’t work on MY SQL, except for the fact the MY SQL has easier Backup facilities.

The background for this is that I was making changes to a table, but wanted a backup of the latest version. Microsoft makes it ridiculously complicated to back up individual tables and restore them, and I didn’t have time to read manuals or try out third-party software.

The script below simply takes the entire table selected and copies it under a new name, giving you both tables to compare and rename/restore with ease.

Loading...

I have since used this script several times and seems an easy way of making sure you don’t ruin a perfectly good table!