3

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

1 Answers1

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