--拡張イベントのblocked_process_reportイベントを保存しているログテーブルに対してのクエリ
select top 1000 * from xevent_dump with(nolock)
where time_stamp between 'yyyy/mm/dd hh:mm' and 'yyyy/mm/dd hh:mm'
order by time_stamp, is_headblocker desc
select * from sys.dm_exec_sql_text(0x0200000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
select * from sys.dm_exec_sql_text(0x0400ff7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
select * from sys.dm_exec_sql_text(0x0300ff7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
CREATE PROCEDURE sys.sp_changetracking_remove_tran (
@objid INT
,@csn BIGINT
,@batch_size INT
,@stat_value BIGINT OUTPUT
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @stmt NVARCHAR(1000)
SELECT @stat_value = 0
IF object_name(@objid) IS NOT NULL
AND @csn IS NOT NULL
BEGIN
IF @csn IS NOT NULL
BEGIN
SELECT @stmt = N'delete top(@batch_size) from sys.' + quotename(object_name(@objid)) + ' where sys_change_xdes_id in (select xdes_id from sys.syscommittab ssct where ssct.commit_ts <= @csn)'
EXEC sp_executesql @stmt = @stmt
,@params = N'@csn bigint, @batch_size int'
,@csn = @csn
,@batch_size = @batch_size
SELECT @stat_value = @@rowcount
END
END
END