> Give the two approaches specified (sort in recordset vs dynamically sort
SP), does the client-side approach have any specific benefits over the
other approach.
Yes! Dynamic sorting in the SP will almost certainly lead to dynamic SQL
and IF/ELSE structures, both of which can lead to recompiles since the query
plan can either be bad, atypical, or non-existent. The statement in the
article Chris referenced is bang on, don't add extra sorting in the database
unless necessary. The database server has plenty of other things it can
waste CPU cycles and memory allocation on, believe me.
The web server, on the other hand, has very little processing to do (in
general).
While we're talking about the "client", there are two different "client"
tiers we are talking about here, and I'm not sure which "client" you have
assumed is less efficient. There is the "client" of the stored procedure
itself, typically a web server or a web farm. Then there is the "client" of
the web server or web farm, e.g. the end user's PC.
Since you can also allow dynamic sorting of, say, an HTML table in
client-side JavaScript, which can leverage yet a third machine which is,
again generally, underutilized: the client's PC. Depending, of course, on
the nature of the audience... if your web site is a Matlock reunion site you
may not be able to get away with as much assumption on client PC power as,
say, a Photoshop resource site.
A