I have a SQL CLR function like this:
public partial class UserDefinedFunctions { [Microsoft.SqlServer.Server.SqlFunction(TableDefinition = "number int", FillRowMethodName = "FillRow")] public static IEnumerable MyClrFunction(object obj) {
I would like to use it as follows:
DECLARE @x arrayOfInt INSERT INTO @x VALUES (10) INSERT INTO @x VALUES (20) INSERT INTO @x VALUES (30) SELECT * FROM dbo.MyClrFunction(@x)
arrayOfInt:
CREATE TYPE [dbo].[arrayOfInt] AS TABLE( [item] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [item] ASC ) WITH (IGNORE_DUP_KEY = OFF) )
The problem is that arrayOfInt is not compatible with sql_variant. Is it possible to write a CLR Table-value function that takes an array (table) argument?
sql-server sqlclr user-defined-functions table-valued-parameters
VΓ‘clav dajbych
source share