4

I am creating a CLR UDF using external name and second level nested class names seem not to be permitted. Is this the case? When using the following syntax and including a first level class name and associated method, I am able to bind a UDF to the method, but not if I included additional subclass levels.

    CREATE FUNCTION [dbo].[udf_test](@variable [nvarchar](MAX))
    RETURNS [nvarchar](MAX) WITH EXECUTE AS CALLER
    AS 
    EXTERNAL NAME [assembly].[ns.first.second].[method]
    GO

Thanks

2

As far as I can tell (I did some testing of my own), this is not supported.

The documentation hints at this:

If the class has a namespace-qualified name that uses a period (.) to separate namespace parts, ...

Since there's no mention of a class-qualified name, I'm assuming SQL Server will traverse the hierarchy only by namespaces, with the last name being the class itself. There wasn't any way I could find to delimit the namespace and class name portions of the fully-qualified class name either.

What I wonder, though, is why your code is structured this way? The method you need to specify must be static, so nesting it within an extra class scope seems like you're (ab)using a class in place of a namespace.

  • I did not know nested namespaces was possible. Now I do. – Alex Erwin Feb 25 '13 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.