0
votes

For reasons I won't go into I have a .NET 4.0 class that I need to use in a SQL Server 2005 CLR UDF. I know SQL Server 2005 only supports .NET 2.0 CLR so is there ANYTHING I can do to make the 4.0 class work? Rewriting the class in 2.0 will be very time consuming. Can I register the 4.0 class for COM interop and then reference it from the 2.0 CLR or something? Any help would be appreciated. Thanks!

1
I had to do the same thing, it was a big pain. Luckily I persuaded management to upgrade to 2012 :). But @chris-p 's answer is really the only way to do it. - Mansfield
You at least able to persuade your management. Some peoples still like to remain in legacy sql server 2005 edition. [Licensing mode of Sql server 2012+] also restrict a bit to user in up-gradation - Kamran Shahid

1 Answers

1
votes

You could write an adapter class that is COM accessible to sit in front of your .NET 4.0 assembly then consume the adapter in your 2005 UDF.