Monday, March 12, 2012

How to handle a "stored function" ?

I handled a "stored function" like a "stored procedure" and got the exception:

"The request for procedure 'XY' failed because 'XY' is a function object."

Can someone provide me example code how to handle "stored functions" ?


I think you are talking about user defined functions.

If so - udf's are not callable directly. Try this: "select XY (... )"


You are right - with "select XY(...)" I get "XY is not a recognized function name". What is missing?
You may need to do SELECT dbo.XY(..)

where dbo is the database owner that created the function.

Hi,
I am not sure if this example solves your problem.
Notice the owner before the function name.
SELECT dbo.DateOnly(GETDATE())


HI,

Or if your function returns a table as a result the you can use it like a normal table:

SELECT * FROM dbo.MyFunction()

cheers,

Paul June A. Domag

Labels: , , , , , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home