Add server-side compilation ability to SQL CLR - by Greg Low - Australia

Status : 


Sign in
to vote
ID 265266 Comments
Status Active Workarounds
Type Suggestion Repros 3
Opened 3/25/2007 8:51:19 PM
Access Restriction Public


The current model in which a developer generates an assembly and then passes it to a DBA and says "trust me" is failing to allow for the typical dynamics involved. To the DBA, this assembly is like a black box.

Also, the current model ties databases directly to versions of the .NET Framework. While there is currently only a single supported version of this now, this won't remain the case and will lead to a versioning mess in the future. DBA's won't want to hear about things like publisher policies, etc. or whatever will be required to deal with it.

Further, the current model requires a DBA to be comfortable with Visual Studio, even when implementing what would otherwise be simple managed code functions. This is harming SQL CLR adoption.

If the managed code source was processed when scripting a database instead of the assembly binaries, much of these issues would be avoided.

Sign in to post a comment.
Posted by CheetahAfoot on 3/5/2017 at 2:56 PM
Yep. Highly wanted. But 10 years from the report...
Posted by J-S-B on 3/31/2015 at 6:02 AM
I too want this. There is another post asking for this ability in another way here:
Please see my comments there.
Posted by GV1973 on 11/1/2011 at 1:33 PM
This will make life so much easier it's tough to explain. Working with 11 server trying to keep clr libraries in synch, half the time things are smooth the other half makes me think if it was worth it.
Not needing to deploy assembly will be awesome.
Posted by Jason Kresowaty on 8/31/2008 at 6:19 AM
See also "Write Routines Directly in .NET Languages" (, which is the same thing with a different suggested syntax.
Posted by Microsoft on 8/20/2007 at 2:34 PM
Hi Greg,

First of all i would like to thank you for the detailed feedback and articulating the need for this feature. We have heard several requests on this in the past and we are looking at it closely and will try to enable it in a future release.

Vineet Rao
Program Manager
SQL Server Engine
Posted by Greg Low - Australia on 3/25/2007 at 8:51 PM
The one remaining issue would be how to implement assembly references. I think that the default assembly could already have the references that are the default ones when you currently start a database project in Visual Studio. Other references required by the function (or procedure or type, etc.) could be passed like this:

CREATE FUNCTION somefunction AS CLRCOMPILE('C#','function code goes here', 'extra references required go here')

alternately, something like:

ALTER ASSEMBLY default ADD REFERENCE 'reference goes here'