Why hasn't MSSQL made a WHERE clause mandatory by default?
- by Josh Einstein
It seems like a no brainer to me. I've heard countless stories about people forgetting the WHERE clause in an UPDATE or DELETE and trashing an entire table. I know that careless people shouldn't be issuing queries directly and all that... and that there are legitimate cases where you want to affect all rows, but wouldn't it make sense to have an option on by default that requires such queries to be written like:
UPDATE MyTable SET MyColumn = 0 WHERE *
Or without changing the language,
UPDATE MyTable SET MyColumn = 0 WHERE 1 = 1 -- tacky, I know