How can we help you today? How can we help you today?

Add object existence checks option is preventing ALTER

When "Add object existence checks" is checked the generated script fails to perform alter's. Note the generated script below only executes the alter if the object does not exist.
PRINT N'Altering [dbo].[AccuCastCustom_DistinctValueCountsPDE]'
GO
IF OBJECT_ID(N'[dbo].[AccuCastCustom_DistinctValueCountsPDE]', 'P') IS NULL
EXEC sp_executesql N' -- =============================================
-- Author:      Mike
-- Create date: 7/10/14
-- Description: This stored procedure returns a count of various distinct values.
-- [mmason] 9/8/14 Added @StartDate & @EndDate
-- =============================================
ALTER PROCEDURE [dbo].[AccuCastCustom_DistinctValueCountsPDE]
dschaeff
0

Comments

6 comments

  • Anu D
    Thanks for contacting us and sorry you're experiencing issues.

    We've logged this issue as a bug SC-7610.

    I have meetings with product management on Fridays, so I'll get an update from them at that point.

    Are you okay with using v10 for now or not using that comparison option?
    Anu D
    0
  • dschaeff
    Yes, I am fine using V10.
    dschaeff
    0
  • Mike U
    I'm pleased to tell you that this bug has been fixed in the latest version of SQL Compare, 11.1.2.28. You can get this version via Help -> Check for Updates..., or you can download it from here (release notes).
    Mike U
    0
  • andrew.nowak
    I just experienced this error attempting to use object existence checks while altering a function using version 11.1.3.30:
    "...
    PRINT N'Altering [dbo].[function_x]'
    GO
    IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[function_x]') AND (type = 'IF' OR type = 'FN' OR type = 'TF'))
    EXEC sp_executesql N'/* ..."
    andrew.nowak
    0
  • Mike U
    This problem was fixed for functions in version 11.1.4, which is a Frequent Updates version. To enable frequent updates, follow these instructions.
    Mike U
    0
  • andrew.nowak
    Worked perfectly; thanks Mike.
    andrew.nowak
    0

Add comment

Please sign in to leave a comment.