Reputation: 25711
I'm testing out some SQL CLR stuff in VS 2008 and SQL Server 2005, how do I install a user defined function on the database? I built it and have the DLL, but now what?
Upvotes: 1
Views: 3333
Reputation: 280320
You would use CREATE ASSEMBLY
. e.g.:
CREATE ASSEMBLY MyAssembly FROM 'C:\path\fille.dll' WITH PERMISSION_SET = SAFE;
GO
And then optional syntax for CREATE FUNCTION
that references the function in your assembly (the external name will be dependent on how you structured your code):
CREATE FUNCTION dbo.MyFunction(@param <data_type>)
RETURNS <data_type>
AS EXTERNAL NAME MyAssembly.SqlServerFunctions.FunctionName;
Upvotes: 2