Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

doubt about delete and truncate

Hello guys

I have a table with 1.000.000 of rows, I need to delete all rows from my table leaving only one week behind, something that could be done this way:

delete from table where tb_date< 01/20/2008

If I use delete, I will have an increase in log.
if I use truncate and dell all my table, I will have an increase in log?

thanks

Avatar of drydenhogg
drydenhogg

Truncate will occupy very little space in the log, but will remove all records and reset any identity counters.
Avatar of chapmandew
You'll have to use delete unless you have your table partitioned in such a way that would allow you to remove a partition.....which I am guessing you don't have.

You can't set criteria on a truncate statement....it is not recorded in the transaction log as well.
ASKER CERTIFIED SOLUTION
Avatar of drydenhogg
drydenhogg

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry....you're right.  
Avatar of hidrau

ASKER

thanks