Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Exactly. There is no need given TRUNCATE exists.


No entirely. DELETE will work with cascading foreign keys, while TRUNCATE will not, at least on SQL Server. Also, DELETE is logged and (I believe) TRUNCATE is not. Having said that, I agree that a WHERE clause should be required - you can always say "WHERE 1=1" or similar if you really mean to delete all rows.


well, the only difference is that truncate also resets the auto-increment to zero. But you could allow where 1=1 to make it explicit if people really wanted an unbounded DELETE FROM.




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

Search: