deadlock issue which accessign data -sql table

Rock Hitman 46 Reputation points

System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 58) was deadlocked on lock resources with another process and has been chosen as the deadlock victim

ALTER PROCEDURE [dbo].[usp_InsData_Select]
@Year int = NULL

  Select  [ID]
        FROM [dbo].[InsData]
        Where [Year] = @Year
        ORDER BY [ID]


SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,253 questions
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,516 questions
{count} votes

2 answers

Sort by: Most helpful
  1. AmeliaGu-MSFT 13,956 Reputation points Microsoft Vendor

    Hi RockHitman-2461,

    Currently the information you gave is too vague to analyze.
    Could you please share us the deadlock xml report and deadlock graph?
    You can go to Management -> Extended Events ->Sessions -> system_health-> right click package0.event_file-> View Target Data, and filter the information about deadlock details.
    Please check this article which might help.

    Best Regards,

    0 comments No comments

  2. Erland Sommarskog 98,811 Reputation points

    A deadlock is a transient error which occurs because your process conflicts with another process. You can always try to rerun the operation, and maybe it works the next time.

    To understand in detail why the deadlock work, you will need to work with your DBA, who can analyse logs or set up required tracing. However, you would only do this, if the deadlock is recurring and becomes a real problem. A single deadlock is nothing to get upset over.

    0 comments No comments