I defined a User Defined Type as
namespace AddOns{
[SqlUserDefinedType(typeof(JsonObjectFormatter))]
public class JsonObject
{
public string Value {get;set;}
... // this is just a dummy representation
}
}
I want to define a Table Valued Function that returns a datatype
REFERENCE ASSEMBLY [AddOns];
CREATE TYPE Insight.dbo.JsonRow
AS TABLE
(
[Id] Guid,
[Value] AddOns.JsonObject
);
However I get an error
'E_CSC_USER_INVALIDCOLUMNTYPE: 'AddOns.JsonObject' cannot be used as column type.
Description:
The column type must be a supported scalar, complex or user defined type.
Resolution:
Ensure the column type is a supported type. For a user defined type, make sure the type is registered, the type name is fully qualified, and the required assembly is referenced by the script.'
*** Compile failed !
I have registered the appropriate DLL in my local instance of ADLA and I am able to access the type in the procedures SELECT
statements when I am persisting the data to a file. But cannot return it as a TVF return type