>OTOH, why clutter up the server with potentially dozens of SP's the results of which may only be needed by one developer in one part of an application ?
>
>Conversely, if an SP is used there's a much greater possibility that a developer (or a DBA) may modify it to suit some specific need without realizing that it could impact on another area of the app.
>
>And I don't think the reference to 'constant fiddling' is relevant. Admittedly Naomi could probably whip up a SP in less time - conversely I'd be constantly fiddling with the T-SQL syntax :-{
I'm not exactly sure why this time I thought of going with the LINQ version rather than SP. Surely SP would take me a minute to write.
On the other hand, I, at least, learn 'let' syntax which apparently results in the subquery similar to what the original T-SQL was doing. (As I checked generated SQL using SQL Profiler).
I am thinking I am going to re-write this method to use SP after all.
UPDATE. I re-did this as a stored procedure.
Thanks, Kevin.
If it's not broken, fix it until it is.
My Blog