Hi Peeps, Is there a way of getting the source code from a CLR assembly? We have a database created by another department that has a CLR assembly used in a SP, and we need to change the CLR because it is referencing a column that doesn't exist anymore and we need to update it. Can we update the CLR without the source code, or is there a way to get the source code from the assembly.
I'll add an answer in here... 1 - The script to extract the assembly from the database at
http://serverfault.com/questions/139703/extracting-a-sqlclr-assembly is not correct. `SELECT @IMG_PATH = content FROM sys.assembly_files WHERE assembly_id = 65536` will return an arbitrary file from the assembly, and there is no requirement that the assembly only has one file. If you look at the [MSDN reference for sys.assembly_files] when you will see that you want to limit it `WHERE file_id = 1` to obtain the assembly DLL. 2 - .NET reflector does not always decompile things correctly. I have had instances in the past where I have been decompiling something in order to recompile it, and the recompiled version has been subtly different. An example of this was when trying to decompile and recompile a third party T-SQL script parsing component - it looked like it worked, but then fell over on some of the less obvious code paths - so definitely tread with caution. :