whats the difference between a stored procedure and a table valued function? they seem to serve the same functions
Asked
Active
Viewed 2,629 times
3
-
Duplicate question: http://stackoverflow.com/questions/178128/functions-vs-stored-procedures – RuudKok May 12 '09 at 10:02
1 Answers
2
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
- 30,118
- 7
- 80
- 91
-
"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 May 12 '09 at 10:49