I have a lot of rows to delete in a table, and using ADO.NET I might send a SqlCommand with this text:
WHILE(1=1)
BEGIN
DELETE TOP(5000) FROM myTable WHERE myval=123
IF @@ROWCOUNT < 5000 BREAK
END
I would wrap that in a transaction or 2 and could then delete in chunks so the DB could come up for air.
I would like to do the same thing but in C# using LINQ-to-SQL, is that possible?
Thanks.