I have a C# CLR table value function that is working great, but I've encountered an issue that I hope that you can help me resolve. I have attached the signature for my method here. The fields that you see listed work great and are always of interest, but... Here is the rub... There are a variable number of other fields that I would like to push out as part of the row in FillRow, but all the documentation that I've seen say nothing about having a variable number of fields. Is it possible? As I understand it, the TableDefinition is only used by Visual Studio for deploying the assembly, and the FillRow method is responsible for emiting the row of data. So... I guess there are two related questions:
1) Can the FillRow method use a variable argument list?
2) Is there a way to provide variable arguments to the TableDefinition?
I have a 2x2 matrix that I need to include as part of the returned row of data from this table value function. The number of rows and/or columns can vary, so you can see why hard coding field names in the signature is an issue. I am trying to find a way to output a variable number of fields.
[SqlFunction(DataAccess = DataAccessKind.Read, FillRowMethodName = "FillRow", TableDefinition =
" [FullName] [nvarchar] (100), " +
" [EmployeeId] [bigint], " +
" [RegularHours] [decimal](8, 2), " +
" [OvertimeHours] [decimal](8, 2), " +
" [HolidayHours] [decimal](8, 2), " +
" [LeaveHours] [decimal](8, 2), " +
" [InsuranceCopay] [decimal](8, 2), " +
" [RegularHourlyRate] [decimal](8, 2), " +
" [OvertimeHourlyRate] [decimal](8, 2) "