| 
 | 
DATE requires the date to be in a date format it recognizes. Try this 
expression instead to convert the date to ISO format first:
days(current date) - days(date(substr(digits(hhdob),1,4) || '-' || 
substr(digits(hhdob),5,2) || '-' || substr(digits(hbdob),7,2)))
If that doesn't work take every element of the express and but them in their 
own column to see which one is fouling up the whole expression.
  ----- Original Message ----- 
  From: Dave Boettcher 
  To: midrange-l@xxxxxxxxxxxx 
  Sent: Wednesday, August 30, 2006 11:55 AM
  Subject: Calculating difference between dates in SQL
  hello, 
  I have been experimenting with interactive SQL to try to formulate a
  statment for later use.
  What I need to do is calculate an age for a client . The client master
  contains the birth date in numeric form 8,0.
  My statement, culled from various books and articles looks like this:
  SELECT                                       
  days(current date) - days(date(hhdob))       
  "Age" , 
  hhdob, hhnaml, hhnamf,               
    hhcase FROM ClientMaster
  The result always seems to look like this:
          "Age"   BIRTH YYYYMMDD            case           
  ++++++++++++++    19,820,926                 4         
  ++++++++++++++    19,820,924                 5         
  ++++++++++++++    19,840,909                 6         
  ++++++++++++++    19,820,915                 7         
  ++++++++++++++    19,820,806                 8         
  ++++++++++++++    19,810,108                 9         
  ++++++++++++++    19,820,330                10   
  >From reading it seems like age should be a number, why can't I see it?
  Thanks in Advance for any help, 
  Dave Boettcher      
  -- 
  This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
  To post a message email: MIDRANGE-L@xxxxxxxxxxxx
  To subscribe, unsubscribe, or change list options,
  visit: http://lists.midrange.com/mailman/listinfo/midrange-l
  or email: MIDRANGE-L-request@xxxxxxxxxxxx
  Before posting, please take a moment to review the archives
  at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.