Ivan-Mark Debono
Ivan-Mark Debono

Reputation: 16330

How to manually deploy a CLR stored procedure?

I created a CLR stored procedure:

public class StoredProcedures
{
    [SqlProcedure]
    public static void InsertProduct(SqlString param1, SqlString param2, SqlString param3)
    {
        using (SqlConnection conn = new SqlConnection("context connection=true"))
        {
        }
    }
}

I compiled and managed to add the assembly in SQL server:

CREATE ASSEMBLY [Assembly.Namespace] FROM 'path here';

But what is the SQL syntax to create a SQL procedure that maps to this CLR stored procedure?

Upvotes: 0

Views: 1083

Answers (1)

Remus Rusanu
Remus Rusanu

Reputation: 294407

Example C in CREATE PROCEDURE:

CREATE ASSEMBLY HandlingLOBUsingCLR
FROM '\\MachineName\HandlingLOBUsingCLR\bin\Debug\HandlingLOBUsingCLR.dll';
GO

CREATE PROCEDURE dbo.GetPhotoFromDB
(
    @ProductPhotoID int,
    @CurrentDirectory nvarchar(1024),
    @FileName nvarchar(1024)
)
AS EXTERNAL NAME HandlingLOBUsingCLR.LargeObjectBinary.GetPhotoFromDB;
GO

Upvotes: 3

Related Questions