DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 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 Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old April 12th, 2005, 07:42 AM
Syngin Syngin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Windsor Ontario
Posts: 150 Syngin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 58 m 52 sec
Reputation Power: 8
Send a message via MSN to Syngin
'Nz' in an sql statement

Hi guys,

I'm rebuilding a couple of Access queries that tie into a DB2 database and I've run into something I haven't seen before:

SELECT b.SALERE, Nz([a]![Category],"0000") AS Category,

^--initial portion fo the statement. Its the Nz command I'm unfamiliar with. I've tried Googling this but doing a search involving Nz keeps turning up all sorts of New Zealand web sites. I'm porting this particular app over to PHP/MySQL so, if I know what it does, I can hopefully recreate it.

Thanks
__________________
Where are we going and why am I in this handbasket?

Reply With Quote
  #2  
Old April 12th, 2005, 08:21 AM
Syngin Syngin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Windsor Ontario
Posts: 150 Syngin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 58 m 52 sec
Reputation Power: 8
Send a message via MSN to Syngin
Quote:
Originally Posted by Syngin
Hi guys,

I'm rebuilding a couple of Access queries that tie into a DB2 database and I've run into something I haven't seen before:

SELECT b.SALERE, Nz([a]![Category],"0000") AS Category,

^--initial portion fo the statement. Its the Nz command I'm unfamiliar with. I've tried Googling this but doing a search involving Nz keeps turning up all sorts of New Zealand web sites. I'm porting this particular app over to PHP/MySQL so, if I know what it does, I can hopefully recreate it.

Thanks


Hmm, it would appear to be Not Zero maybe?

Reply With Quote
  #3  
Old April 12th, 2005, 03:20 PM
fractalvibes fractalvibes is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2003
Location: Waco, Texas
Posts: 632 fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 14 h 11 m 13 sec
Reputation Power: 22
that would be my guess, not zero as the result of that expression, but unsure what the expression means. WHat
does the sql return when you run it?

fv
__________________
...because that is the way we have always done it. We've been doing it like that for 80 Years! (How do we change that mindset?)

Reply With Quote
  #4  
Old April 13th, 2005, 08:12 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
Nz is an access function that allows you to return a specified value when the condition is null.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp

In the above case, it would return "0000" when the category field is null.

Remember, when your dealing with access code, your not dealing with real sql, your dealing with jetsql which allows for all kinds of vb/vba code to intermingle with the sql itself. To do something to the equivilant in sql, you would use the case statement.
i.e. case category when null then "0000" end

Reply With Quote
  #5  
Old April 29th, 2005, 01:07 PM
AFD62 AFD62 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 7 AFD62 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 33 m 32 sec
Reputation Power: 0
The equivalent in DB2 is Value(([a]![Category],'0000')

Reply With Quote
  #6  
Old May 25th, 2005, 10:51 AM
jmayo jmayo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 3 jmayo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 20 sec
Reputation Power: 0
Quote:
Originally Posted by Syngin
Hi guys,

I'm rebuilding a couple of Access queries that tie into a DB2 database and I've run into something I haven't seen before:

SELECT b.SALERE, Nz([a]![Category],"0000") AS Category,

^--initial portion fo the statement. Its the Nz command I'm unfamiliar with. I've tried Googling this but doing a search involving Nz keeps turning up all sorts of New Zealand web sites. I'm porting this particular app over to PHP/MySQL so, if I know what it does, I can hopefully recreate it.

Thanks


NZ takes a null field(value) and makes the resultant an integer...

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > 'Nz' in an sql statement


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 5 hosted by Hostway