Very quick and simple question, if I try and run the following code in SQL Server:
DELETE FROM Table
WHERE @ID=ID
On a table that has an ID column, what is the expected behavior if @ID doesn’t match any rows? Does nothing get deleted? Is it generally safe to use WHERE statements that have a chance to match nothing – regardless of the operation being performed?
Bonus points if you can tell me weather it’s worthwhile to catch statements like this on the backend before they get sent up to the Database.