>>It's not a simple tasks to avoid deadlocks sometimes. You should read more on deadlocks, what causes them and how to avoid them.
>>In general, the most common cause of deadlock is when statement 1 locks table A and than B and Statement 2 locks table B and Then A. It's simplified example but may give you an idea where to look.
>
>But, as those situations can happen, having a retry mechanism would help.Basically, I can detect this error and retry. This only occurs at the SQL Exec command. So, as a safety measure, this is something I can do at first. Then, I can take a look at where exactly this is caused.
If you're using SP, you can also probably try to use TRY/CATCH within SQL Server itself. I need to read up if deadlock situations are caught by TRY/CATCH, I don't remember of hand.
If it's not broken, fix it until it is.
My Blog