Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSenum_merge_sd

  No additional text.


Syntax
create procedure sys.sp_MSenum_merge_sd
(
@name nvarchar(100),
@time datetime = NULL
)
as
begin
    set nocount on

    declare @start_time datetime
    declare @agent_id int
    declare @time_up datetime

    
    -- security check
    -- only replmonitor can execute this
    
    if not (is_member(N'db_owner') = 1 or isnull(is_member(N'replmonitor'),0) = 1)
    begin
        raiserror(14260, 16, -1)
        return (1)
    end

    select @agent_id = id from dbo.MSmerge_agents where name=@name

    IF @time IS NULL
        select @time = GETDATE()

    /*
    ** Minute-approximate @time can be used.
    ** Note: The select only return datetime data with minute precision
    */
    IF  DATEPART(second, @time) = 0 AND
        DATEPART(millisecond, @time) = 0
    BEGIN
        SELECT @time_up = DATEADD(second, +59, @time)
        SELECT @time_up = DATEADD(millisecond, +999, @time)
    END
    ELSE
        SELECT @time_up = @time

    declare @session_id int

    select top 1 @session_id=session_id
    from dbo.MSmerge_sessions with (READPAST)
    where agent_id=@agent_id and
    end_time<= @time_up
    order by session_id DESC

    -- have to fake rate/time and count as we only have cumulative count number
    select  ms.runstatus,
            'time' = sys.fn_replformatdatetime(ms.end_time),
            rh.comments, ms.duration,
        -- Note: return average rate here !!! delivery_rate column is current rate
        ms.delivery_rate,
        ms.download_inserts, ms.download_updates, ms.download_deletes, ms.download_conflicts,
        ms.upload_inserts, ms.upload_updates, ms.upload_deletes, ms.upload_conflicts,
        rh.error_id
        from dbo.MSmerge_history rh with (READPAST), dbo.MSmerge_sessions ms with (READPAST)
        where
        rh.agent_id = @agent_id and
        rh.session_id = @session_id and
        ms.agent_id = @agent_id and
        ms.session_id = @session_id
        order by rh.session_id desc, rh.timestamp desc
end

 
Last revision 2008RTM
See also

  sp_instdist (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash