• Hi there,

    I'm not sure if you're clear on the purpose of stored procedures and functions. If you're used to common programming languages, you'll find out that stored procedures are very similar to methods. They're both designed to be a set of code that will create an action. Stored procedures might or might not return result sets.

    Functions on the other side, work as in any other language. They're designed to return a value. In SQL they can return scalar values or result sets that can be used as tables.

    Once you understand the difference, you'll know which one you should use.

    You've received good advice on how to use them and where you can find more information. As we don't know where do you want to call the code from, we can't give a great advice.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2