SQL Server中的标量值,表值和聚合函数有什么区别?从查询中调用它们需要一种不同的方法,还是以同样的方式调用它们?
安装VS2012的发行版后,我无法找到SQL CLR proect模板.我该如何创建这种类型的项目.
谢谢!
我们为SQL Server 2008 R2开发了一个程序集.
大会已经工作了一个星期.程序集内的托管存储过程在整个星期都运行良好,然后它停止工作.我们已经多次看到这个问题了.使其再次工作的方法是重新启动SQL Server.
Msg 10314, Level 16, State 11, Line 4
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65536. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'myAssembly, …Run Code Online (Sandbox Code Playgroud) 假设程序集dll:
using Microsoft.SqlServer.Server;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System;
using System.Text;
namespace CLRFunctions
{
public class T
{
[SqlFunction(DataAccess = DataAccessKind.Read)]
public static String NormalizeString(String s, String normalizationForm)
{
NormalizationForm form = NormalizationForm.FormC;
if (String.Equals(f, "FormD", StringComparison.OrdinalIgnoreCase))
form = NormalizationForm.FormD;
return = s.Normalize(form);
}
}
}
Run Code Online (Sandbox Code Playgroud)
注意:将程序集目标指向.NET 3.5,因为SQL Server不支持.NET 4.0
将程序集复制到一个位置,"创建"程序集工作正常:
CREATE ASSEMBLY CLRFunctions FROM 'c:\Program Files\My App\CLRFunctions.dll';
Run Code Online (Sandbox Code Playgroud)
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
RECONFIGURE;
GO …Run Code Online (Sandbox Code Playgroud) 尝试运行CLR存储过程时收到以下错误.任何帮助深表感谢.
Msg 10314, Level 16, State 11, Line 1
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'orders, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one …Run Code Online (Sandbox Code Playgroud) 有没有相当于
PRINT 'hello world'
Run Code Online (Sandbox Code Playgroud)
哪个可以从CLR(C#)代码调用?
我正在尝试在我的函数中输出一些调试信息.我无法运行VS调试器,因为这是一个远程服务器.
谢谢!
当我尝试从.Net程序集(.Net 3.5)在SQL 2008中创建程序集时,我收到以下错误,错误说我必须将以下任一属性设置为true,我该怎么做?
数据库所有者(DBO)具有EXTERNAL ACCESS ASSEMBLY权限为TRUE
该数据库具有TRUSTWORTHY数据库属性
程序集使用证书或非对称密钥签名,该密钥具有相应的登录权限,具有EXTERNAL ACCESS ASSEMBLY权限.
完整的错误如下,
程序集"SQLLogger"的CREATE ASSEMBLY失败,因为程序集"SQLLogger"未获得PERMISSION_SET = EXTERNAL_ACCESS的授权.如果满足以下任一条件,则授权程序集:数据库所有者(DBO)具有EXTERNAL ACCESS ASSEMBLY权限,并且数据库具有TRUSTWORTHY数据库属性; 或者使用具有EXTERNAL ACCESS ASSEMBLY权限的相应登录的证书或非对称密钥对程序集进行签名.
提前致谢!
问题:在SQL Server 2005中,如何列出使用程序集xy的所有SQL CLR函数/过程(例如MyFirstUdp)?
例如,为查询参数MyFirstUdp列出HelloWorld的函数
CREATE PROCEDURE HelloWorld
AS EXTERNAL NAME MyFirstUdp.[SQL_CLRdll.MySQLclass].HelloWorld
GO
Run Code Online (Sandbox Code Playgroud)
我跑了之后
CREATE ASSEMBLY MyFirstUdp FROM 'C:\Users\username\Documents\Visual Studio 2005\Projects\SQL_CLRdll\SQL_CLRdll\bin\Debug\SQL_CLRdll.dll
Run Code Online (Sandbox Code Playgroud)
我可以列出所有程序集和所有函数/过程,但我似乎无法将程序集与函数/过程相关联...
这是我看到的一个新现象,我的数据库名称是:MySQLCLR,有一个脚本总是在其中提供此名称:
:setvar DatabaseName "MySQLCLR"
Run Code Online (Sandbox Code Playgroud)
现在突然间,每当我对我的sqlclr项目代码进行任何更改并重新编译时,新的输出脚本都会在其中添加_1,如下所示:
:setvar DatabaseName "MySQLCLR_1"
Run Code Online (Sandbox Code Playgroud)
对代码和后续构建的另一个更改将生成:
:setvar DatabaseName "MySQLCLR_1_1"
Run Code Online (Sandbox Code Playgroud)
等等....
知道为什么会这样吗?
Windows2012 R2上的VS2012,MSSQL2008 R2
在最近重新启动我们的开发服务器期间,SQL Server开始使用.NET 4.0SQLCLR.这意味着在SQL中没有使用CLR,或者至少通过阅读这些来源是我的理解:
http://software.intel.com/en-us/blogs/2009/10/16/sql-server-2008-sqlclr-net-framework-version/
www.sqlskills.com/BLOGS/BOBB/post/On-SQL-Server-and-NET-40.aspx
我们得到的只是这种类型的错误消息:
消息6517,级别16,状态1,行1无法创建AppDomain"xxx.dbo [ddl] .3".方法的类型签名不是Interop兼容的.
运行声明(由@ john-christensen建议)
select * from sys.dm_clr_properties
Run Code Online (Sandbox Code Playgroud)
得到以下信息:
*Name* *Value*
directory C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
version v4.0.30319
state CLR is initialized
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这个或如何强制SQL Server CLR使用早期版本的框架?