[thelist] case statement catch-all? MSSQL

Ken Schaefer Ken at adOpenStatic.com
Thu Aug 25 00:24:11 CDT 2005


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of Brian Cummiskey
: Subject: Re: [thelist] case statement catch-all? MSSQL
: 
: Ken Schaefer wrote:
: 
: >Whilst this can be done using T-SQL, as you can see from the various SQL
: >statements being proposed, it's not the easiest thing to do. It's also
: >not very efficient.
: >
: >Your presentation layer code (PHP, .NET, CF) is probably 
: >*very* efficient at adding three numeric values together, 
: >and that's all that the final value (the combined % is). 
: > Is it possible to have the presentation layer code
: > add the values together?
: >
: >
: Sure, it can be done on the scripting side, but IMO, it would be much
: more time consuming, especially since i'm stuck with classic asp.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You are joking me, surely? 

You think that evaluating CASE statements inside a sproc and generating a sum
is more efficient that adding three numeric values in ASP? The former (using
a sproc) is an order of magnitude (at least) more costly.

Surely your ASP code would look something like:

<%
With Response
	.Write(firstValue)
	.Write(secondValue)
	.Write(thirdValue)
	.Write(firstValue + secondValue + thirdValue)
End With
%>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: the code is horible, but, it works...  and we can 
: always buy more ram :D
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RAM doesn't help you with lock contention, and all the other things that
start to happen when you do things "because you can"

But hey, what do I know? 

However, if you're free next Thursday and in Australia you can come to my MS
Tech.Ed 2005 session on debugging crashes, hangs and performance issues in
IIS 
:-)

In all seriousness, it's your app, and you know the environment best. But
given that it's taken a day to get this working, and it's not very efficient,
and the alternative involves next to no code, I'm struggling to think why
this is a good idea.

Cheers
Ken


More information about the thelist mailing list