tags:

views:

266

answers:

1

whats the difference between a stored procedure and a table valued function? they seem to serve the same functions

+1  A: 

Table-valued functions can return only a single result set; SPs can return multiple result sets.

You can subsequently query over the results of table-valued functions - but not with SPs.

So table-valued functions are more flexible if you don't need multiple result sets.

Joe Albahari
"SPs can return multiple result sets" -- or, indeed, none i.e. they may just 'do stuff' and return a return value and/or raise warnings and/or errors.
onedaywhen