Tuesday, February 12, 2013

"Error saving map. Stored procedure returned non-zero result." error message when you deploy the BizTalk Server 2009 applications in BizTalk Server 2009 Administration Console

A KB article related to this issue in BizTalk 2010 can be found here: http://support.microsoft.com/kb/2673264

However, somewhere between BizTalk 2009's CU3 and CU6 release this same issue was introduced to BizTalk 2009.  At the time of writing, there is no known fix from Microsoft but what you can do is temporarily rollback the BizTalkMgmt.dbo.dpl_SaveMap sproc so you can continue importing applications.

To rollback the sproc to CU3 state remove the highlighted code block below that has been introduced by a CU:


ALTER PROCEDURE [dbo].[dpl_SaveMap]
(
    @ArtifactId int,
    @AssemblyId int,
    @IndocDocSpecName nvarchar (256) ,
    @OutdocDocSpecName nvarchar (256) ,
    @ArtifactXml ntext
)
AS
    if not (exists(select * from bt_DocumentSpec where docspec_name = @IndocDocSpecName) and
        exists(select * from bt_DocumentSpec where docspec_name = @OutdocDocSpecName))
        return -1 --Fail if in and out schemas of a map are not present


    DECLARE @shareid  uniqueidentifier
    SELECT @shareid = newid()
    INSERT INTO bt_XMLShare( id,target_namespace, active, content )
        VALUES( @shareid, N'', 1, @ArtifactXml )
    INSERT INTO bt_MapSpec(
        itemid,
        assemblyid,
        shareid,
        indoc_docspec_name,
        outdoc_docspec_name
    )
    VALUES( @ArtifactId, @AssemblyId, @shareid, @IndocDocSpecName, @OutdocDocSpecName )
    RETURN 0
GO

3 comments:

  1. Thanks! I was about to re-image my pc if it was not for this post.

    ReplyDelete
  2. I did what you mention in above, but i still got the issue. to fix it what i did was alter above code part you have mention to return 0

    "if not (exists(select * from bt_DocumentSpec where docspec_name = @IndocDocSpecName) and
    exists(select * from bt_DocumentSpec where docspec_name = @OutdocDocSpecName))
    return 0 --Fail if in and out schemas of a map are not present"

    Thank you for the inside knowledge

    ReplyDelete
    Replies
    1. Hi Poorna. By taking your approach bt_MapSpec would not be updated and your platform's integrity may be compromised.

      The workaround proposed restores the 'last known good state' of dpl_SaveMap and nothing more. I would reinstate the original sproc and see if there might be something else at play in your scenario.

      Delete