|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
'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? |
|
#2
|
|||
|
|||
|
Quote:
Hmm, it would appear to be Not Zero maybe? |
|
#3
|
|||
|
|||
|
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?) |
|
#4
|
||||
|
||||
|
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 |
|
#5
|
|||
|
|||
|
The equivalent in DB2 is Value(([a]![Category],'0000')
|
|
#6
|
|||
|
|||
|
Quote:
NZ takes a null field(value) and makes the resultant an integer... |
![]() |
| Viewing: Dev Shed Forums > Databases > DB2 Development > 'Nz' in an sql statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|