sql - C# deadlock information -


is there way report on microsoft sql server deadlock information in c#? have c# program running queries, updates, etc... gets deadlock error error message not particularly helpful in diagnosing problem: transaction (process id 347) deadlocked on lock resources process , has been chosen deadlock victim. rerun transaction.

right have track down dba go search through sql logs deadlock graph. wondering if there way @ information programatically?

the details of deadlock not returned client. in later versions of sql server, 1 method deadlock details programmatically querying system_health extended event session sample query below, can tweak specific situation. note method requires view server state permissions.

--get deadlock_report ring_buffer target select        xed.value('@timestamp', 'datetime') creation_date,        xed.query('.') extend_event (        select cast([target_data] xml) target_data        sys.dm_xe_session_targets xt        inner join sys.dm_xe_sessions xs        on xs.address = xt.event_session_address        xs.name = n'system_health'        , xt.target_name = n'ring_buffer' ) xml_data cross apply target_data.nodes('ringbuffertarget/event[@name="xml_deadlock_report"]') xeventdata(xed) order creation_date desc; go 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -