Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
I did not know nested namespaces was possible. Now I do. –  Alex Erwin Feb 25 '13 at 23:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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