Take a look at Red Gate's SQL Prompt - it's a great product (as are most of Red Gate's contributions)
SQL Inform is also a great free (online) tool for formatting long procedures that can sometimes get out of hand.
Apart from that, I've learned from painful experience it's a good thing to precede any DELETE
statement with a BEGIN TRANSACTION
. Once you're sure your statement is deleting only what it should, you can then COMMIT
.
Saved me on a number of occasions ;-)