[thelist] Avoiding Divide by Zero within SQL...

Anthony Baratta Anthony at Baratta.com
Fri Nov 30 15:37:08 CST 2001


At 12:55 PM 11/30/2001, you wrote:

>so what happens when bar is null?  you get a null answer -- which might be
>okay, i dunno, you decide, but if you don't want a null answer, change the
>above to

I solved this problem by changing any null data to be zero. Prior to 
mungining it with the CASE statement. But I like your use of the Coalesce 
function. Reading the documentation it was not clear how to use that, so I 
appreciate the new information.

>since you can use CASE, you might not really need the above, but since you
>are adding stuff to your memory banks, remember that there are usually
>several ways to achieve a goal in sql

Always hungering for more information (or Guinness ;-). More tools the merrier!

Have a great weekend.

<tip type="ASP and Physical Paths for Web Directories" author="Anthony 
Baratta">

Too often I've seen people scrambling for the true physical path of IIS web 
directory in order to support some type of file management routine or 
upload scenario.

While you could store the path in a Constant for later use, if you move the 
site or use a site archiving policy, the physical paths change. Causing you 
to dive into the code looking for the places you need to update.

Try using the Server.MapPath function. If you know the virtual directory 
(and you should know at least that much info, right?? ;-), you can have IIS 
tell you where exactly that directory resides with out having to hard code 
that info into your scripts.

e.g.

         strTargetWebPath = "/virutal/directory/path"

         ....

         strPhysicalPath = Server.MapPath(strTargetWebPath)

NOTE: MapPath does not support the ../../ pathing.

Two sides of the same coin:

         strPhysicalPath = Server.MapPath(Request.ServerVariables("PATH_INFO"))

         This should be the same as:

         strPhysicalPath = Request.ServerVariables("PATH_TRANSLATED")
</tip>
----
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."





More information about the thelist mailing list