| Author: King Cobra 20 Nov 2008 | Member Level: Gold | Rating:  Points: 5 |
Delete It delete rows from a table. To delete an employee with id 1 from the employee table, the sql delete query would be like, DELETE FROM employee WHERE id = 1;
Truncate The SQL TRUNCATE delete all the rows from the table and free the space containing the table. The following is the example query TRUNCATE TABLE employee;
For More Details View this link.. http://www.geekinterview.com/question_details/24530
Cheers King Cobra Its Too Bad To Be Too Good
|
| Author: lalitha 20 Nov 2008 | Member Level: Gold | Rating:  Points: 5 |
Hi
Delete statement removes rows of a table one by one. DELETE statement is a DML (DATA MANIPULATION LANGUAGE) statement. A DML action can be rolledback if the data is not committed. A delete statement can have a where clause But Truncate removes all rows by deallocating the data pages assigned to the table Truncate statement is a DDL statement. DDL actions cannot be rolled back. In Truncate statement does not allow conditions truncate is faster than delete statement .
Regards Lalitha
|
| Author: mohamed hanif 20 Nov 2008 | Member Level: Gold | Rating:  Points: 5 |
TRUNCATE is a DDL command and cannot be rolled back. All of the memory space is released back to the server.
DELETE is a DML command and can be rolled back.
Both commands accomplish identical tasks (removing all data from a table), but TRUNCATE is much faster.
TRUNCATE : You can't use WHERE clause
DELETE : You can use WHERE clause
Include another diff with above
Delete will maintain the log details, but truncate didnt that..means each and every delete will be stored in LF file
|
| Author: Bunty 20 Nov 2008 | Member Level: Diamond | Rating:  Points: 4 |
Hi,
The TRUNCATE and DELETE statement are identical in functinally. The differences are as follows,
1>TRUNCATE statement works faster than DELETE statement.
2>TRUNCATE statement will not fire trigger whereas DELETE statement will fire trigger.
3>TRUNCATE statement does not have a WHERE clause whereas IN DELETE statement WHERE clause is optional.
Thanks and Regards S.S.Bajoria
Thanks & Regards S.S.Bajoria
|
| Author: Reddy 20 Nov 2008 | Member Level: Gold | Rating:  Points: 2 |
truncate is faster than delete
but u wont get back data if u use truncate. u can get if u use delete
|
| Author: gowthami chowdary 22 Nov 2008 | Member Level: Gold | Rating:  Points: 5 |
We can use the TRUNCATE statement to remove all rows from a table. A very important thing to note is that the TRUNCATE operation cannot be rolled back and no triggers are fired.
We can use the DELETE command to remove rows from a table. We must specify a WHERE clause in our DELETE statements so only some rows will be removed.If we do not do that all rows will be removed and that something we most certainly never want. DELETE operations will cause all DELETE triggers on the table to fire.
|