ManOnAMission
ManOnAMission

Reputation: 1043

Can I SET DEADLOCK_PRIORITY via SqlConnection in .NET?

Can I set the DEADLOCK_PRIORITY for a stored procedure via a SqlConnection or some other means in my .NET programm? Or does it only work via a

 SET DEADLOCK_PRIORITY...

call in the stored procedure itself?

Thanks all.

Upvotes: 4

Views: 2606

Answers (1)

IvanH
IvanH

Reputation: 5159

When you open a connection just execute

SET DEADLOCK_PRIORITY...

For example:

dim cn as new SqlConnection(cstring)
Dim cmd as SQlCommand=cn.CreateConnection
cmd.CommandText="SET DEADLOCK_PRIORITY NORMAL"
cn.Open
cmd.Execute

What is set remains valid until connection is closed.

There is no option to set DEADLOCK_PRIORITY - see All SQL Server SqlConnection properties or Setting a deadlock victim

Upvotes: 2

Related Questions