ALTER/RECREATE ASSEMBLY with dependency

pil0tpil0t Posts: 14
edited July 1, 2009 8:27AM in SQL Compare Previous Versions
I have database with CLR ASSEMBLY,
assembly contains a few scalar udf's, for example
myFunc1, myFunc2
This functions is used in computed columns in few tables.

I have changed "target platform" of ASSEMBLY from "x86" to "Any cpu"
and so, i have to DROP/CREATE assembly. (ALTER ASSEMBLY don't work when changing processorarchitecture)

Now i need to recreate assembly.
For this purpuses i create empty database, create my assembly (with changed processorarchitecture) and run SQL Compare.
Cheched my assembly to ALTER,
next i got table of dependencies of assembly, there are only my functions (myFunc1, myFunc2)
in script firs drops functions, then drops assemblym then create assembly, then create functions;
But this script is not correct, DROP function statmentns fails, because functions is used by computed columns in tables
So correct script should drop columns, drop funcs, drop assemblys , and then create all of this.

Making this thigs by hand is very boring, because i have about hundred columns used this clr udf's.

is there any way to automate this process?

Comments

  • I don't have a way to automate the column drops, I'm afraid, but SQL Compare ought to be doing it for you and I've added this forum post to the bug report for this issue to try and get it fixed for you (although it probably won't be coming out in the next point release, as CLR dependencies tend to be awkward).
    Software Developer
    Redgate Software
Sign In or Register to comment.