Groups | Blog | Home
all groups > sql server programming > december 2004 >

sql server programming : Delete Data Without Log


Yash
12/20/2004 11:49:01 PM
Hi,
Is there any way to delete specific records from a table with out generating
the transaction logs.
--
Regards,
Yash
mark baekdal
12/21/2004 12:57:02 AM
I can tell you how I do it for the fastest way to delete records with the
least amount of logging...

first step is to select all the data I want to keep into a new permanent
table, using select into then I drop any related fks to the original table,
drop the original table, rename the new table and rebuild my indexes, pks and
unique constraints and re-create the foreign keys with nocheck. This can save
alot of time when doing large deletes as there is little logging required - I
always think of the log as something that needs to be recorded in the case of
a rollback - this method means the information regarding individual rows is
not required in the event of a rollback. All of the above I bound within a
transaction.

regards,
Mark Baekdal
www.dbghost.com
+44 (0)208 241 1762
Living and breathing database change management for SQL Server

[quoted text, click to view]
Tibor Karaszi
12/21/2004 9:13:13 AM
No. TRUNCATE TABLE removes all rows. DELETE is always logged. In Simple recovery mode, log records
are still generated, but log is automatically truncated.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


[quoted text, click to view]

Uri Dimant
12/21/2004 10:15:57 AM
Yash
No. Each transaction (DELETE/INSERT/UPDATE) is recorded in the TRANSACTION
LOG.

[quoted text, click to view]

AddThis Social Bookmark Button