SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 20th, 2001, 07:46 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Nulls, zeros, NZ - haaalp

<i><b>Originally posted by : Nomit (h.babraa@lse.ac.uk)</b></i><br /><br />Hello<br /><br />I have SQL that returns the sum of a field. When there are no entries it returns a null. In access you can use NZ (NVL in Oracle) to force a zero to be returned. How do you do this is with ASP? I get a message : NZ is considered undefined<br /><br />Cheers<br /><br />

Reply With Quote
  #2  
Old June 25th, 2001, 04:13 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Jerry Scannell (JScannell1@home.com)</b></i><br /><br /><br /><br />------------<br />Nomit at 6/20/2001 5:46:10 AM<br /><br /><br />Hello<br /><br />I have SQL that returns the sum of a field. When there are no entries it returns a null. In access you can use NZ (NVL in Oracle) to force a zero to be returned. How do you do this is with ASP? I get a message : NZ is considered undefined<br /><br />Cheers<br /><br /><br />I have been going around in circles for months with the Null, Empty, Nothing quagmire that surrounds ASP. It seems the problem centers around the scripting truism that data doesn't have to have a specific data type. As such, empty fields are Null when you would hope they would be 0. I have found a solution that sort of works for most instances. Here it is:<br /><br />In the following examples, objValue is a variable returned from a select statement.<br /><br />1. If you wish to verify a numeric value do the following. The assumption is that there souuld be a numeric value (even 0). Therefore, if the length of the trimmed variable is > 0 then it should be a number and IsNumeris() with perform the testing. Otherwise it is a Null (or empty or whatever ASP wants to call it) so I return false.<br /><br />Function IsNumber ( objValue )<br /> Dim Local_String<br /> Local_String = Trim ( objValue )<br /> if len ( Local_String ) > 0 then<br /> IsNumber = IsNumeric ( Local_String )<br /> else<br /> IsNumber = False<br /> end if<br />end Function<br /><br />And as an extra data validation question because I know you will run across the problem with empty or null date fields. The date manipulation functions (e.g. datediff() ) will crash if you pass it an empty date field. So do this:<br /><br /> if IsDate ( objDATEVAL ) then<br /> DaysSinceLast = DateDiff ( "d", objDATEVAL, Date )<br /> else<br /> DaysSinceLast = 0<br /> end if<br /><br /><br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Nulls, zeros, NZ - haaalp


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway