Saturday, February 25, 2012

Assembly MyAssembly was not found in the SQL catalog of database MyDB

I’m trying to register my CLR UDF in SQL 2005 using this code

CREATE FUNCTION GetSomething() RETURNS INT

AS EXTERNAL NAME MyAssembly.MyFunction.MyMethod

When I run it against my DB I get this error:

Assembly MyAssembly was not found in the SQL catalog of database MyDB

I’ve successfully registered my custom assembly in the DB (I see it under Assemblies folder), and I’ve set CRL Enabled to 1 in my DB.

What am I doing wrong?

Thanks in advance

A couple of things:

1. make sure that the CREATE FUNCTION call is actually executed in the database where MyAssembly is located.
2. Make sure that you spell the name correctly of the assembly

if both of those are OK:
1. then check that you do not have any namespaces in the class name. For example, VB injects a namespace into the assembly, so the class name would be [namespace.classname].
2. make sure that the classname and method name are capitalize correctly - they are case sensitive.

Niels

|||I have same problem and I do deployment using Visual Studio .NET 2005 final release, it is as nightmare to see these outstanding bug free products ...

No comments:

Post a Comment