Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSgetpeerwinnerrow

  No additional text.


Syntax
create procedure sys.sp_MSgetpeerwinnerrow
(
	@originator_id nvarchar(32) = '%', --int
	@row_id nvarchar(19) = '%',   -- timestamp
	@conflict_table nvarchar(270)
)
as
begin
    set nocount on
    declare @retcode int = 0
				,@cmd nvarchar(4000)
				,@whcmd nvarchar(4000) = N'__$is_winner = 1 '

	select @cmd = N'select ''__$origin_datasource_srvname'' = h.originator_node,  ''__$origin_datasource_db'' = h.originator_db, * from ' + ISNULL(NULLIF(QUOTENAME(PARSENAME(@conflict_table, 2)) + N'.', N'.'), N'') + QUOTENAME(PARSENAME(@conflict_table, 1))



	
    /*
    ** Security Check.
    */
    exec @retcode = sys.sp_MSreplcheck_publish
    if @@ERROR <> 0 or @retcode <> 0
        return(1)
    
    -- passed the security check
    

    if (@originator_id != N'%')
    begin
            select @whcmd = @whcmd + N' and __$originator_id = ' + quotename(@originator_id, '''')
    end
    if (@row_id != N'%')
    begin
            select @whcmd = @whcmd + N' and ((__$change_id is not null and __$change_id = ' + @row_id
					+ N') or(__$change_id is null and __$row_id in (select __$change_id from '
					+ ISNULL(NULLIF(QUOTENAME(PARSENAME(@conflict_table, 2)) + N'.', N'.'), N'') + QUOTENAME(PARSENAME(@conflict_table, 1))
					+ N' where __$row_id = ' + @row_id + N')))'
    end
    select @cmd = @cmd + N' c join MSpeer_originatorid_history h on c.__$origin_datasource = h.originator_id where ' + @whcmd

    
    -- execute the generated select
    
    execute (@cmd)
    
    -- all done
    
end

 
Last revision 2008RTM
See also

  sp_MSdrop_repltran (Procedure)
sp_MShelptranconflictcounts (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