This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
The documentation states that it is supported but I can't figure out how to call it. I tried using a ProcedureQuery but an error was returned.
Any help would be great. |
|
|
What was the error? UDF names need to be qualified with the schema prefix e.g. "dbo.GetWidgets" rather than just "GetWidgets" -- could that be the issue? |
|
|
No, I did use dbo.functionname. I will try it again tonight and get the actual code for you |
|
|
This is the udf
|
|
|
It looks like you currently need to use FindBySql rather than Find to call a TVF: var cmd = _unitOfWork.Context.DataProviderObjectFactory.CreateCommand(); |
|
|
That does work as expected. It just was not something that could be found easily in the documentation. And for anyone needing to pass parameters, it is as easy as cmd.Parameters.Add(new SqlParameter("@sample",12)); Thanks Joe |
|
|
I guess I spoke too soon, for some reason if I pass 0 for the parameter value, the sql that is generated is like this
exec sp_executesql N'SELECT * FROM dbo.udfzzzzzzz(@sincehours)',N'@sincehours bigint',@sincehours=default UDF's don't know how to deal with defaults, they must have a parameter passed in. I even set the udf to use a default ALTER FUNCTION dbo.udfzzzzzzz
The error returned from sql, even in a sql management studeio window is
The parameterized query 'stuff here' expects the parameter '@sincehours', which was not supplied. How do I force the sql parameter into the function and not set defaults? 0 can have a meaning for an integer. Joe |
|