Functions are used to do specific things for you, like calculate the sum of all the records, parse a string, count the number of records and so on.
There is no difference between the functions and the stored procedures other than the functions are stored procedures that have been written for you. You can call a function inside a procedure and as a mater of fact you can call a stored procedure inside a stored procedure.
I hope I did not confuse you too much
Comment