4 ms·
I tend to write my DELETE statements by writing a SELECT first then edit that into the delete version
by spacecowboy_lon 11y ago
I tend to write my DELETE statements by writing a SELECT first then edit that into the delete version
- danieltillett 11y agoThis is exactly what I do too.
- cwilkes 11y agoI'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.
- sixothree 11y agoI 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.