Forum

This content is now out of date.

Visit Our Community

Error running Stored Procedure: because the function is valued function object

Updated documentation can now be found via our YF community HERE

Hi, I have created a function that returns a table, but when I try to use it in YellowFin, I got the following error: Error running Stored Procedure: The request for procedure 'GetMILStateReport' failed because 'GetMILStateReport' is a table valued function object. Does this feature support? What do I need to do to return a result set from a T-SQL?
Hi Mentor,

Yellowfin should be able to use a stored procedure that returns a table, a situation where a stored procedure won't work is when the table name is passed into the SP, for example, SELECT * FROM @tablename.

Regarding Transact-SQL, Yellowfin only supports single statement queries, I can't say whether this might be causing you to get that error without seeing your stored procedure, so can you please paste your SP (or attach it) to this post, and also tell us which database you are using.

Regards,
Dave
I was trying to use YF to call a custom function that returns a table type.

This is what the function look like:
[code]CREATE Function ufnGetRateReport (@StartDate DateTime, @EndDate DateTime)
RETURNS @ResultSet TABLE
(
[RecordDate] DateTime,
[Value] int,
[Duration] DateTime
) AS
BEGIN
...
END
[/code]

I managed to work around the issue by creating a stored procedure wraps the function call

[code]
CREATE PROCEDURE uspGetRateReport(@StartDate DateTime, @EndDate DateTime)
AS
SELECT RecordDate, Value, Duration
FROM ufnGetRateReport(@StartDate, @EndDate)
[/code]
Hi Mentor,

That is a clever work around :).

Unfortunately that's the only way to return the table type at this point in time.
We have gone ahead and raised it as an enhancement request so something we can hopefully support in the future.

Apologies for the inconvenience this has caused.

Regards,
David