• IMHO (10/2/2014)


    I know this post is old but I had the same problem and thought I'd share the solution I found.

    When you compile the VB assembly in VS, pay attention to the Project Properties. Under the Application tab there is a "Root namespace" textbox. This has to be part of the EXTERNAL NAME syntax when creating the function in T-SQL. I thought that, since I didn't have a namespace in my code, I didn't need to use it in my CREATE FUNCTION code but I kept getting the "Could not find type'xxx' in assembly 'xxx' error until I added it.

    -----------------------

    INCORRECT:

    -----------------------

    CREATE FUNCTION dbo.RegExIsMatch

    (

    @pattern NVARCHAR(4000),

    @input NVARCHAR(MAX),

    @Options int

    )

    RETURNS BIT

    AS EXTERNAL NAME

    RegEx.[RegexFunctions].RegExIsMatch

    GO

    -----------------------

    CORRECT: (Note the syntax must include the "hidden" namespace -- Assembly_Name.[Namespace.Class_Name].Function Name)

    -----------------------

    CREATE FUNCTION dbo.RegExIsMatch

    (

    @pattern NVARCHAR(4000),

    @input NVARCHAR(MAX),

    @Options int

    )

    RETURNS BIT

    AS EXTERNAL NAME

    RegEx.[Regex.RegexFunctions].RegExIsMatch

    GO

    This saved me! Thanks!