Resolve error "Sql Parameterized Exception issue detected" in DOC1 and EngageOne Designer

Product Feature: Utilities

Issue

When running a publish job from the command line, it fails with the following error:

Sql Parameterized Exception issue detected

Cause

This generally occurs when a publication has been deleted, and a new publication is created with the same name.  This can be verified by showing deleted items in the workcenter.
 

Resolution

UPDATED: November 9, 2017
You can work around this by upgrading to the latest version of Designer and Generate, changing the name of the non-deleted publication or by running the following SQL script (you must backup your repository before doing this):

ALTER FUNCTION [dbo].[ufn_GetObjectDetailsFromPath]
(
    @pnvcDesiredObjectPath nvarchar(MAX)
    ,@piItemTypeId int
    ,@pnvcObjectName nvarchar(MAX)
)
RETURNS nvarchar(MAX)
AS
BEGIN
   DECLARE @nvcRetVal nvarchar(max)
   
   SELECT TOP 1 @nvcRetVal = dbo.ufn_GetNCharFromGuid(L.OwnerExternalItemGuid) + '-' + dbo.ufn_GetNCharFromGuid(EI.Guid)
   FROM ExternalItem EI
   INNER JOIN Version V
      ON V.ExternalItemId = EI.Id
   INNER JOIN Label2Version L2V
      ON L2V.VersionId = V.Id and L2V.DeletedFlag = 0 -- DWF DOC-6561 -- only return items that have not been deleted.
   INNER JOIN Label L
      ON L.Id = L2V.LabelId and L.Type = 1 and L.SubType = 1 -- DWF DOC-6561 -- Only interested in the current label
   WHERE (EI.ItemTypeId = @piItemTypeId)
      AND (V.Name = @pnvcObjectName)
      AND ([dbo].[ufn_GetParentPath] (L.Id, EI.Guid, DEFAULT) = @pnvcDesiredObjectPath)
         


   IF (@nvcRetVal IS NULL)
   BEGIN
      SET @nvcRetVal = ''
   END

   RETURN @nvcRetVal
END
GO