Question Transaction (Process ID 65) was deadlocked

MiltonSnider

Member
Joined
Sep 15, 2009
Messages
7
Programming Experience
Beginner
I am getting the following error with sql server 2005.

Transaction (Process ID 65) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

I'm trying to send out 14,000 emails. I pull the email addreses from a datareader, construct an email and send async. I update the done field of the record after the email is sent. The datareader uses a select statement and the update uses the update statement, no transaction stuff, since I have no idea how to use transactions. I close all connections as soon as possible and I close the datareader as soon as the Do While rd.read is finished.
I can't figure out where the bottle neck is. If I use a sleep(100) command between every loop, I get no errors but this really slows things down. So, how should 14000 records be read and updated in sql 2005?

regards
Milton
 
Back
Top