If a statement return rows doing a simple select over the data base, is there performance difference between implement it using Function and Procedures? I know it is prefera
As soon as SQL sees a BEGIN or END, the system cannot simplify the contents out.
So really the difference just comes down to thd fact that the results of a function can be used in an outer query, for joins, ignoring some columns and so on.
Your best bet is actually to use either a view or an inline table-valued function, so that SQL can simplify it down and only do the part that you're interested in. Look for my post on "Dangers of BEGIN and END" at my blog for more info.