Hacker News new | past | comments | ask | show | jobs | submit login

I tend to write my DELETE statements by writing a SELECT first then edit that into the delete version



I've turned to creating a temp table and putting the primary keys from the select statement into there so I can guard myself against the thing that was to delete a handful of rows deleting everything. Plus with that you can do another join and see if those rows have some sort of value in it that you didn't expect.


I also put my DELETE statement on a line by itself and comment out the line. In SQL Server execution processes only the selected text. So I select starting with DELETE then run.


This is exactly what I do too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: