Why hasn't MSSQL made a WHERE clause mandatory by default?
Posted
by Josh Einstein
on Stack Overflow
See other posts from Stack Overflow
or by Josh Einstein
Published on 2009-05-17T00:24:48Z
Indexed on
2010/04/01
22:33 UTC
Read the original article
Hit count: 287
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
© Stack Overflow or respective owner