Options

CHECK constraint dependencies upon user-defined functions?

jalbertjalbert Posts: 18
edited May 28, 2014 10:49AM in SQL Compare Previous Versions
I have a project that has a CLR assembly, several user-defined functions which call the assembly, as well as tables that have CHECK constraints which refer to those user-defined functions. I am using the new functionality which allows me to compare scripts with a database.

When I modify the assembly, SQL Compare 6 properly determines that the user-defined functions are dependent upon the assembly. (It generates the required DROP FUNCTION and CREATE FUNCTION statements in the synchronization script.) However, it does not appear to detect that the user-defined functions are used by the table-level CHECK constraints. Therefore when I attempt to synchronize, I get an error message similar to:

Cannot DROP FUNCTION 'dbo.SomeFunction' because it is being referenced by object 'some_table_check_constraint'.

Is there a setting that I should check to get this to behave properly?

Comments

  • Options
    I'm afraid you've come across a bug in our dependancy handling, and there isn't an obvious workaround other than taking the functions out of the check constraints before synchronizing, or manually synchronizing the assemblies.

    I've forwarded this issue to the relevant developer, but we've just frozen development on 6.1 so I can't give you a timescale for when a fix will be available. (Hopefully we'll be able to get it into the next point release, which is mostly dealing with source control issues, but dependancy issues concerning CLR objects are quite tricky, so it depends how much development time we have available.)
    Software Developer
    Redgate Software
  • Options
    This is still a problem in version 6.2. I hope there are plans to fix this relatively soon; we'd like to put SQL Compare in the hands of all of our devs but this problem is holding it up. Thanks.
  • Options
    Is this still an issue - we seem to be getting this problem now, in version 10.2
  • Options
    hi

    i have same problem is lastest version but i cant resolve it

    thanks
Sign In or Register to comment.