4 ms·
Exactly. There is no need given TRUNCATE exists.
by mikeklaas 15y ago
Exactly. There is no need given TRUNCATE exists.
- user24 15y agowell, 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.
- fmx 15y agoNo 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.