Reputation: 1043
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
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