CREATE PROCEDURE sys.sp_article_validation
(
@publication sysname, /* publication name */
@article sysname, /* article name */
@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 */
@subscription_level bit = 0, /* Whether or not the validation is only picked up by a set of subscribers */
@reserved int = NULL, /* If not null, the sp is called from sp_publication_validation */
@publisher sysname = NULL /* only non-null for heterogeneous publishers */
)
AS
BEGIN
DECLARE @cmd nvarchar(4000)
DECLARE @retcode int
DECLARE @publisher_type sysname
SET @retcode = 0
EXEC @retcode = sys.sp_MSrepl_getpublisherinfo @publisher = @publisher,
@publisher_type = @publisher_type OUTPUT,
@rpcheader = @cmd OUTPUT
IF @retcode <> 0
RETURN (@retcode)
if (@publisher_type = 'MSSQLSERVER')
begin
set @cmd = @cmd + N'sys.sp_MSarticle_validation '
EXEC @retcode = @cmd
@publication,
@article,
@rowcount_only,
@full_or_fast,
@shutdown_agent,
@subscription_level,
@reserved
end
else
begin
-- Heterogeneous articles are handled directly by sp_IHarticle_validation
SET @publisher = UPPER(@publisher) COLLATE DATABASE_DEFAULT
set @cmd = @cmd + N'sys.sp_IHarticle_validation '
EXEC @retcode = @cmd
@publication,
@article,
@rowcount_only,
@full_or_fast,
@shutdown_agent,
@subscription_level,
@reserved,
@publisher,
@publisher_type
end
RETURN (@retcode)
END