How to update a CLR Assembly without dropping assembly from SQL Server

Solution 1:

I think you're looking for alter assembly. From BOL:

If the FROM clause is specified, ALTER ASSEMBLY updates the assembly with respect to the latest copies of the modules provided. Because there might be CLR functions, stored procedures, triggers, data types, and user-defined aggregate functions in the instance of SQL Server that are already defined against the assembly, the ALTER ASSEMBLY statement rebinds them to the latest implementation of the assembly. To accomplish this rebinding, the methods that map to CLR functions, stored procedures, and triggers must still exist in the modified assembly with the same signatures. The classes that implement CLR user-defined types and user-defined aggregate functions must still satisfy the requirements for being a user-defined type or aggregate.

One of the examples on the same page seems like it'd do the trick:

ALTER ASSEMBLY ComplexNumber 
FROM 'C:\Program Files\Microsoft SQL Server\90\Tools\Samples\1033\Engine\Programmability\CLR\UserDefinedDataType\CS\ComplexNumber\obj\Debug\ComplexNumber.dll' 

Solution 2:

To add to Ben Thul's answer, this can be accomplished remotely fairly easily via SQL Server Management Studio's GUI.

  1. Under the Object Explorer for your database -> Programmability, right click on Assemblies and select 'New Assembly...'.

  2. Browse to your updated DLL.

  3. Instead of clicking 'OK' (which will fail, as an assembly of the same name already exists) click 'Script' at the top of the New Assembly window.
     
    You will be dropped into a SQL Query that includes a 'CREATE ASSEMBLY' line followed by a huge blob that is the DLL you just selected.

  4. Change 'CREATE' to 'ALTER' and then execute!

The Script also created an 'AUTHORIZATION' line for me that I had to remove before executing; your milage may vary.

I hope this helps someone else without filesystem access to their servers.

Hopefully Microsoft will make this a first-class operation in SSMS someday, but this is a fairly easy workaround until they do.