Stored Procedure vs Functions compilation and performance difference


Staff member
Recently I gave an inetrview in which the interviewer asked me to explain the most basic difference between Stored Procedure and UDF's.

I was able to recall a couple of differences as <a href="" rel="nofollow noreferrer">listed here</a> but he didn't accept any of them as the <strong>BASIC</strong> difference.

Answer according to him was that SP's are only compiled once while UDF's are compiled everytime they are called resulting in UDF's being considerably slower than stored procedure.

Now I have searched but couldn't get a clear cut answer whether this assertion is true.
Please verify this.