deadlock issue which accessign data -sql table

Rock Hitman 46 Reputation points
2021-12-10T00:05:52.1+00:00

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
)
AS

  Select  [ID]
        ,[InsuranceID]
        ,[CarMake]
        ,[CarModel]
        ,[VehicleType]
        ,[Year]
        FROM [dbo].[InsData]
        Where [Year] = @Year
        ORDER BY [ID]

GO

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
Transact-SQL
Transact-SQL
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
    2021-12-10T03:01:44.773+00:00

    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,
    Amelia

    0 comments No comments

  2. Erland Sommarskog 98,811 Reputation points
    2021-12-10T22:46:47.73+00:00

    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