要使用.Net写的自定义聚合函数,需开启clr功能
reconfigure;
exec sp_configure 'clr enabled', '1'
exec sp_configure 'clr enabled', '1'
注册assembly
CREATE ASSEMBLY StringUtilities FROM 'D:\程序\CRM\CRM_APP\CustomDefineAggregate\bin\Release\CustomDefineAggregate.dll'
WITH PERMISSION_SET=SAFE;
WITH PERMISSION_SET=SAFE;
注册聚合函数
CREATE AGGREGATE Concatenate(@input nvarchar(4000))
RETURNS nvarchar(4000)
EXTERNAL NAME [StringUtilities].[Concat];
GO
RETURNS nvarchar(4000)
EXTERNAL NAME [StringUtilities].[Concat];
GO
删除聚合
drop aggregate dbo.Conactenate
drop assembly stringutilities
drop assembly stringutilities