You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ORDER BYxml.deadlock_xml.value('(/event/@timestamp)[1]', 'datetime') DESC
321
323
OPTION ( RECOMPILE );
322
324
325
+
/*Optimization: if we got back more rows than @Top, remove them. This seems to be better than using @Top in the query above as that results in excessive memory grant*/
326
+
SET @DeadlockCount =@@ROWCOUNT
327
+
IF( @Top < @DeadlockCount ) BEGIN
328
+
WITH T
329
+
AS (
330
+
SELECTTOP ( @DeadlockCount - @Top) *
331
+
FROM #deadlock_data
332
+
ORDER BY #deadlock_data.deadlock_xml.value('(/event/@timestamp)[1]', 'datetime') ASC)
333
+
DELETEFROM T
334
+
END
335
+
323
336
/*Parse process and input buffer XML*/
324
337
SET @d =CONVERT(VARCHAR(40), GETDATE(), 109);
325
338
RAISERROR('Parse process and input buffer XML %s', 0, 1, @d) WITHNOWAIT;
0 commit comments