Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_IHpublication_validation

  No additional text.


Syntax


-- Name:
--          sp_IHpublication_validation

-- Description:
--          HREPL publication validation steps

-- Security:
--          Internal
-- Requires Certificate signature for catalog access

-- Returns:
--          Success / failure

-- Owner:
--          

CREATE PROCEDURE sys.sp_IHpublication_validation
(
	@publication	sysname,
	@rowcount_only	smallint = 1,	-- type of check requested
	@full_or_fast	tinyint = 2,	-- full (0) fast (1), or conditional fast (2)  method to calculate rowcount
	@shutdown_agent	bit = 0,		-- shut down agent after validation if 1
	@publisher		sysname
)
AS
BEGIN
	set nocount on

	declare @publication_id	int
	declare @next_article	sysname
	declare @curr_article	sysname
	declare @retcode		int
	declare @publish_bit	int
	declare @repl_freq		int
	declare @fetch_status	int

	set @publish_bit = 1
	
	-- Check if the database is published for transactional
	if sys.fn_MSrepl_istranpublished(DB_NAME(),1) <> 1
	begin
		raiserror(20026, 16, -1, @publication)
		return 1
	end

	-- Get Publication Information
	select	@publication_id = p.pubid,
			@repl_freq = repl_freq
	from	syspublications p,
			MSpublications m,
			master.dbo.sysservers s
	where	p.name = @publication
	  and	p.pubid = m.publication_id
	  and	s.srvid = m.publisher_id
	  and	s.srvname = @publisher
		
	if @publication_id is null
	begin
    	raiserror(20026, 16, -1, @publication)
    	return 1
	end

	-- Article validation is not valid for snapshot publications
	if @repl_freq <> 0
	begin
    	raiserror(21484, 16, -1, @publication)
    	return 1
	end

	declare hC CURSOR LOCAL FAST_FORWARD for
	select	a.name
	from	sysarticles a,
			MSarticles m,
			master.dbo.sysservers s
	where	a.pubid = @publication_id
	  and	a.artid = m.article_id
	  and	a.pubid = m.publication_id
	  and	s.srvid = m.publisher_id
	  and	s.srvname = @publisher
	  and	(status & 1) <> 0				-- active articles only
	  and	(type & 1) <> 0					-- only checksum tables/views.

	open hC
	fetch hC into @next_article
	
	select @fetch_status = @@fetch_status

	while (@fetch_status = 0)
	begin
		-- Cache current article value
    	set @curr_article = @next_article

    	-- Look ahead to next article
    	fetch hC into @next_article
    	select @fetch_status = @@fetch_status

    	-- If we are at the last article, pass the @shutdown_agent value
    	if (@fetch_status = -1)
    	begin
			exec @retcode = sys.sp_article_validation	@publication	= @publication,
        												@article		= @curr_article,
        												@rowcount_only	= @rowcount_only,
            											@full_or_fast	= @full_or_fast,
            											@shutdown_agent	= @shutdown_agent,
            											@reserved		= 1,
            											@publisher		= @publisher

    	end
    	else
    	begin
        	exec @retcode = sys.sp_article_validation	@publication	= @publication,
        												@article		= @curr_article,
        												@rowcount_only	= @rowcount_only,
														@full_or_fast	= @full_or_fast,
														@reserved		= 1,
														@publisher		= @publisher
		end

    	if @retcode <> 0 or @@error <> 0
    	begin
			close hC
			deallocate hC
			return 1
    	end
	end

	close hC
	deallocate hC

	return 0
end	

 
Last revision 2008RTM
See also

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