When calling User Defined Functions (UDF) you need to specify the schema owner, (dbo in default)
So you need to change your code to:
Main Topics
Browse All TopicsI have tried to create recursive fuctions with MS SQL 2000 and 2005, and have not been sucessfull. I have tried numerous ways and examples from online, none of which have worked.
Below are two examples which do not work on either of my machines. (the + sign doesnt show correctly).
If anyone has experience with recursive SQL procedures I would appreciate your assistance.
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
<<If anyone has experience with recursive SQL procedures I would appreciate your assistance>>
User Defined Functions are not meant for this kind of use. Instead , use Assemblies.
Also be aware that recursive reasonning on a DBMS can be a serious performance killer especially when using temp tables. Keep in mind that you are doing IO's from disks (namely tempdb) and not IO from RAM.
If you could post more details on what you are trying to accomplish, we may suggest an alternative.
HTH
>>User Defined Functions are not meant for this kind of use.
Actually, you can use UDFs recursively in 2005...which is kinda neat.
In reality though, if you're trying to do recursion in 2005, you're better off using a recursive CTE. Here is an article I wrote on how to do it:
http://blogs.techrepublic.
<<Actually, you can use UDFs recursively in 2005...which is kinda neat. >>
Nobody said that he could *not* do it through UDF but simply that it is not recommended perfomance wise.
<<In reality though, if you're trying to do recursion in 2005, you're better off using a recursive CTE. >>
Whether through CTE or through functions or through stored procedures, recursion is a performance killer.
As part of a project I am working on there are formulas and variables which the user can specify. Both are stored in a DB. Right now I querry the information and then on the desktop application I evaluate the formulas.
Everything works just fine, the problem is that my boss wants to be able to call a stored procedure manually to evaulate the return value of a formula. I.E. Open Query Analyzer and type in a query.
He wants to be able to verify that this small piece of the program (because it is a very important piece) works correctly.
There are two steps that need to be done:
1. Substitute all the variables for their correct value from a DB table.
2. Evaluate the mathematical expression.
Thank you for your assistance.
These formulas are part dependent. I.E. The same formula returns a different value depending on the part used.
Some variables are fixed independent of the part - such as labor. Other variables depend on the cost of the material or length of time required.
A Formula might be: Labor+2.5*WheelCost/PartsP
but could be more complex.
After substitution let's say it is 7.8+2.5*6/8
Then it is simple math.
Business Accounts
Answer for Membership
by: Marekch84Posted on 2008-12-22 at 23:03:35ID: 23231793
The example from online works on my sql 2005, but still why you want recursive functions? If you will exceed the limit of 32 callings the function will be stoped and the transaction rolled back. There is a nesting limit of 32 callings.