You are here: Re: Massive delete in DB « MsSQL Server « IT news, forums, messages
Re: Massive delete in DB

Posted by Simon Hayes on 09/06/05 14:32

You can't stop MSSQL using the log, but you can break a single DELETE
into multiple batches (see example below). If you back up the
transaction log from time to time during the batch delete (or put the
database in single user mode first), this should keep the log size
under control. It would probably be a good idea to try it out on a test
system first, and also make a full backup before starting, just in case
something goes wrong.

Simon

set rowcount 50000 -- or whatever

delete from dbo.MyTable
where ...

while @@rowcount > 0
delete from dbo.MyTable
where ...

set rowcount 0

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация