Забавно, но на днях занимался такой же проблемой. При помощи друга был написан такой sql скрипт.
PHP код:
declare cur cursor
for select top 1000 recid from dbo.sysdatabaselog where CREATEDDATE between '01.01.1900' and '04.01.2004'
declare @i int, @s varchar
set @i = (select count(recid) from dbo.sysdatabaselog where CREATEDDATE between '01.01.1900' and '04.01.2004')
set @i = @i / 1000
while @i > 0
begin
open cur
fetch cur
while @@FETCH_STATUS = 0
begin
delete from dbo.sysdatabaselog where current of cur
fetch cur into @s
end
close cur
set @i = @i - 1
end
deallocate cur