I have a process that (at night) take a large chunk of data in the form of a linq2sql query and dumps this as XML (sitemaps). My problem is that I'm sometimes is getting:
System.Data.SqlClient.SqlException: Transaction (Process ID XX) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
This query in readonly and not necessary need to be "transaction safe". Can I write a process like this to avoid the exception?
EDIT:
Basically the code is:
foreach(Record record in MyDataContext.FatTableWithRecords) //about 50' records { //produce some XML (dumped to file when max 50' records or 10MB large) }