попробуйте выполнить скрип по БД Master
use master
GO
IF OBJECT_ID('dbo.fn_getBinaryFromBase64String') IS NOT NULL
DROP FUNCTION dbo.fn_getBinaryFromBase64String
GO
IF EXISTS(SELECT * FROM sys.assemblies WHERE name = 'asbly_base64')
DROP ASSEMBLY asbly_base64
GO
DECLARE @Path nvarchar(1024), @Path1 nvarchar(1024)
BEGIN TRY
SELECT @Path = REPLACE(physical_name,
'MSSQL\DATA\master.mdf',
'MSSQL\Binn\')
FROM master.sys.database_files
WHERE name = 'master';
CREATE ASSEMBLY asbly_base64
FROM @Path+'base.dll'
WITH PERMISSION_SET = SAFE;
END TRY
BEGIN CATCH
SELECT @Path1 = @Path
SELECT @Path = NULL
EXECUTE xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Crystal-Service\RETAIL', 'AppPath', @Path OUTPUT
SELECT @Path = @Path + '\Data\Dll\'
IF @Path IS NOT NULL BEGIN
CREATE ASSEMBLY asbly_base64
FROM @Path+'base.dll'
WITH PERMISSION_SET = SAFE;
END
ELSE
RAISERROR('Файл "base.dll" должен находится в папке %s. Поместите файл в папку и запустите скрипт повторно.',16,1,@Path1);
END CATCH
GO
sp_configure 'clr enabled', 1
reconfigure with override
GO
CREATE FUNCTION dbo.fn_getBinaryFromBase64String( @s nvarchar(max) )
RETURNS varbinary(max)
AS EXTERNAL name asbly_base64.Sample.ConvertBase64ToBinary
GO