如何手动部署CLR存储过程?

时间:2015-03-11 09:34:26

标签: c# sql-server visual-studio-2012

我创建了一个CLR存储过程:

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

我编译并设法在SQL服务器中添加程序集:

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

但是,创建映射到此CLR存储过程的SQL过程的SQL语法是什么?

1 个答案:

答案 0 :(得分:3)

CREATE PROCEDURE中的示例C:

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