Fix ‘The publication does not exist’ Error in sp_article_validation

replicationsql server

DECLARE @p SYSNAME, @a SYSNAME
SET @p = N'[NAME]'
SET @a = N'[ARTICLE]'

EXEC sp_article_validation @p,@a

I'm using the exact name of the publication provided by the table MSpublications (even using NAME or QUOTENAME(N'Name') generates the same error), yet it's saying it doesn't exist. Note that it doesn't work with any other publications either. Yet this is what sp_article_validation (Transact-SQL) says.

SELECT publication
FROM MSpublications
ORDER BY publication 

Best Answer

Ensure you're on the 'publication' DB so USE [publicationDBName] and then execute the SP.

Otherwise, try various combinations such as the below for the NAME variable you're passing to the SP as an argument to the SP in case it's related to it not liking the preceding 'N which indicates that the subsequent string is in Unicode, thereby passing an NCHAR, NVARCHAR or NTEXT value, as opposed to CHAR, VARCHAR or TEXT.

  • SET @p = NAME
  • SET @p = [NAME]