SQL Server 2005 supports CLR so it means we can use CLR in backend so how to do that, I have some function in c# which do some complex manipulation with date-time variable now I want to use those functions in SP. First of all IS IT POSSIBLE TO DO THIS.
SQL Server 2005支持CLR所以这意味着我们可以在后端使用CLR,所以如何做到这一点,我在c#中有一些函数,它使用日期时变量做一些复杂的操作,现在我想在SP中使用这些函数。首先,有可能做到这一点。
2 个解决方案
#1
3
Yes, it is possible to use .NET in a SQL Server 2005 database. Be aware that the .NET version supported by SQL Server 2005 is 2.0.
是的,可以在SQL Server 2005数据库中使用.NET。请注意,SQL Server 2005支持的.NET版本是2.0。
Here's a link for an introduction to Making a CLR stored procedure using Visual Studio
这是使用Visual Studio制作CLR存储过程简介的链接
#2
-1
Take a look this TSQL example
看看这个TSQL示例
USE [XXX] GO SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO CREATE PROCEDURE [dbo].[Testing_XXX]
@broadcastId [int],
@XXXTemplateHtml [nvarchar](max),
@XXXTemplateText [nvarchar](max),
@XXXTemplateSubject [nvarchar](max),
@XXXTemplateEmailHeaders [nvarchar](max),
@XXXTemplateHeader [nvarchar](max),
@XXXTemplateFooter [nvarchar](max),
@masterTemplate [nvarchar](max),
@parseOptions [nvarchar](4000),
@xsltTemplate [nvarchar](max) OUTPUT WITH EXECUTE AS CALLER AS EXTERNAL NAME SolutionXXX.ProjectXXX].[StoredProcedures].[XXX_Parser_Parse] GO
When you call
你打电话的时候
EXTERNAL NAME [SolutionXXX.ProjectXXX].[StoredProcedures].[XXX_Parser_Parse]
It invokes a C# function looks like this
它调用一个C#函数,如下所示
[SqlProcedure]
public static void XXX_Parser_Parse(
SqlInt32 broadcastId,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateHtml,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateText,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateSubject,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateEmailHeaders,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateHeader,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateFooter,
[SqlFacet(MaxSize = -1)]
SqlString masterTemplate,
SqlString parseOptions,
[SqlFacet(MaxSize = -1)]
out SqlString xsltTemplate)
{
//blah blah blh
}
#1
3
Yes, it is possible to use .NET in a SQL Server 2005 database. Be aware that the .NET version supported by SQL Server 2005 is 2.0.
是的,可以在SQL Server 2005数据库中使用.NET。请注意,SQL Server 2005支持的.NET版本是2.0。
Here's a link for an introduction to Making a CLR stored procedure using Visual Studio
这是使用Visual Studio制作CLR存储过程简介的链接
#2
-1
Take a look this TSQL example
看看这个TSQL示例
USE [XXX] GO SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO CREATE PROCEDURE [dbo].[Testing_XXX]
@broadcastId [int],
@XXXTemplateHtml [nvarchar](max),
@XXXTemplateText [nvarchar](max),
@XXXTemplateSubject [nvarchar](max),
@XXXTemplateEmailHeaders [nvarchar](max),
@XXXTemplateHeader [nvarchar](max),
@XXXTemplateFooter [nvarchar](max),
@masterTemplate [nvarchar](max),
@parseOptions [nvarchar](4000),
@xsltTemplate [nvarchar](max) OUTPUT WITH EXECUTE AS CALLER AS EXTERNAL NAME SolutionXXX.ProjectXXX].[StoredProcedures].[XXX_Parser_Parse] GO
When you call
你打电话的时候
EXTERNAL NAME [SolutionXXX.ProjectXXX].[StoredProcedures].[XXX_Parser_Parse]
It invokes a C# function looks like this
它调用一个C#函数,如下所示
[SqlProcedure]
public static void XXX_Parser_Parse(
SqlInt32 broadcastId,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateHtml,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateText,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateSubject,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateEmailHeaders,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateHeader,
[SqlFacet(MaxSize = -1)]
SqlString XXXTemplateFooter,
[SqlFacet(MaxSize = -1)]
SqlString masterTemplate,
SqlString parseOptions,
[SqlFacet(MaxSize = -1)]
out SqlString xsltTemplate)
{
//blah blah blh
}