Class not found in assembly SQL

I am trying to execute my first CLR assembly \ stored procedure. I compiled the code using CSC and added the assembly to the SQL server. The assembly appears, but the class appears to be missing.

C # CODE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.SqlServer.Server;


namespace TextFunctions

public class RegularExpressions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static string RegExReplace(string input, string pattern, string replacement)
    {

        Regex Reginstance = new Regex(pattern);

        return Reginstance.Replace(input, replacement);


    }

      

}

END C # CODE

CREATE FUNCTION CODE

CREATE Function RegExReplace(@Input NVARCHAR(512),@Pattern NVARCHAR(127), @Replacement     NVARCHAR(512))
RETURNS NVARCHAR(512) EXTERNAL NAME RegEx.RegularExpressions.RegExReplace

      

ERROR Could not find Type 'RegularExpressions' in assembly 'RegEx'.

1) Can you see what I'm doing rough?

2) Is there a table or view in sql server that allows me to see classes and functions inside an assembly?

0


a source to share


1 answer


As per your code snippet, your class RegularExpressions

is in namespace TextFunctions

.



Changing your T-SQL code to use TextFunctions.RegularExpressions.RegExReplace should fix it.

+1


a source







All Articles