Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_IHadd_sync_command

  No additional text.


Syntax

CREATE PROCEDURE sys.sp_IHadd_sync_command
(
	@publisher_id		smallint = NULL,
	@publisher_db		sysname,
	@xact_id			varbinary(16) = 0x0,
	@xact_seqno			varbinary(16) = 0x0,
	@originator			sysname = NULL,
	@originator_db		sysname = NULL,
	@article_id			int = NULL,
	@command_id			int = 1,
	@type				int = NULL,
	@partial_command	bit = NULL,
	@command			varbinary(1024) = NULL,
	@publisher			sysname = NULL
)
AS
BEGIN
	SET NOCOUNT ON

	declare @retcode int
	DECLARE @date datetime
	DECLARE @publisher_database_id int
	declare @originator_id int
	DECLARE @syncmask int
	DECLARE @snapshot_bit int

	select @snapshot_bit = 0x80000000

	SELECT @date = GETDATE()

	-------- security check, db_owner
	exec @retcode = sys.sp_MSreplcheck_publish
	if @@ERROR <> 0 or @retcode <> 0
		return(1)

	if @publisher_id is NULL
		select @publisher_id = srvid from master.dbo.sysservers where
			UPPER(srvname collate database_default) = UPPER(@publisher)

	-- Get publisher database id.
	SELECT @publisher_database_id = id from MSpublisher_databases where publisher_id = @publisher_id and
		publisher_db = @publisher_db

	IF @command_id = 1
	BEGIN
		INSERT INTO MSrepl_transactions VALUES (@publisher_database_id,
			@xact_id,  @xact_seqno, @date)
		IF @@ERROR <> 0
			RETURN 1
	END

	IF @command IS NOT NULL
	begin
		if @originator <> N'' and @originator_db <> N'' and @originator is not null and @originator_db is not null
		begin
		set @originator_id = null select @originator_id = id from MSrepl_originators where
			publisher_database_id = @publisher_database_id and UPPER(srvname) = UPPER(@originator) and
			dbname = @originator_db
		if @originator_id is null
		begin
			insert into MSrepl_originators (publisher_database_id, srvname, dbname) values
				(@publisher_database_id, UPPER(@originator), @originator_db)
			select @originator_id = @@identity
		end
		end
		else
		select @originator_id = 0
	

		if( @type in( 37,38 ) )
		begin
	  		declare @syncstat int
			select @syncstat = 38 - @type
			exec sp_MSset_syncstate @publisher_id, @publisher_db, @article_id, @syncstat, @xact_seqno
		end

		INSERT INTO MSrepl_commands (publisher_database_id, xact_seqno, type, article_id, originator_id, command_id, partial_command, command)
		VALUES (@publisher_database_id, @xact_seqno,
			@type | @snapshot_bit, @article_id, @originator_id, @command_id, @partial_command, @command)
	end

	IF @@ERROR <> 0
		RETURN (1)
END

 
Last revision 2008RTM
See also

  sp_MSdrop_repltran (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