May 15, 2012

sp_MSget_session_statistics (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_MSget_session_statistics(int @session_id)

MetaData:

 create procedure sys.sp_MSget_session_statistics   
(
@session_id int
)
as
begin
declare @agent_id int
declare @retcode int

-- the merge agent calls this proc
select @agent_id = 0
select @agent_id = agent_id from dbo.MSmerge_sessions where session_id = @session_id

-- Security Check
exec @retcode = sys.sp_MScheck_pull_access @agent_id = @agent_id, @agent_type = 1 -- merge agent
if @@error <> 0 or @retcode <> 0
return (1)

select duration,
upload_time,
download_time,
prepare_snapshot_time,
schema_change_time,
schema_changes,
bulk_inserts,
metadata_rows_cleanedup,
estimated_upload_changes,
estimated_download_changes
from dbo.MSmerge_sessions with (nolock) where session_id = @session_id

select phase_id,
article_name,
duration,
inserts,
updates,
deletes,
conflicts,
rows_retried,
estimated_changes
from dbo.MSmerge_articlehistory with (nolock) where session_id = @session_id

return 0
end

No comments:

Post a Comment

Total Pageviews