Microsoft SQL Server Create CLR procedure in SQL Server


Example

If you have created .Net method in some class, compiled it into .dll, and imported it into SQL server as an assembly, you can create user-defined stored procedure that references method in that assembly:

CREATE PROCEDURE dbo.DoSomethng(@input nvarchar(max)) 
AS EXTERNAL NAME MyLibrary.[Name.Space.ClassName].DoSomething

You need to specify name of the procedure and signature with input parameters that match .Net method. In AS EXTERNAL NAME clause you need to specify assembly name, namespace/class name where this procedure is placed and name of the method in the class that contains the code that will be exposed as procedure.