• To avoid deadlock, you must have through knowledge of your application.

    1. Identify the deadlocking processes and the object sparticipating in deadlock.

    2. Use program monitoring table, say Program_session having columns program_id and running_date and modify your SPs/or queries such that, it will first check entry in Program_session and verify if running_date is NULL.

    3. If running_date is NULL, then SP can continue with setting running_date to getdate(). And after executing set running_date to NULL.

    4. Else use wait() command to follow steps 3.