× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

Character strings in one of the following formats can be translated by using
the scalare function DATE() without problems:
YYYY-MM-DD, DD.MM.YYYY, MM/DD/YYYY

The date separators are fixed and cannot be changed.
To change the separators in your string, you also can use the scalar
function TRANSLATE.

CREATE VIEW mylib/myview AS 
  (SELECT DATE(TRANSLATE(myfield,'-','/')) AS myDateField FROM mylib/myfile)

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them?  Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Elvis Budimlic
Gesendet: Sunday, February 25, 2007 08:03
An: 'Midrange Systems Technical Discussion'
Betreff: RE: DATE Datatype in SQL View


Let's say you have your alpha date in the following format:

02-25-2007

and your current job is set to *MDY with date separator being '/', something
like this would work:

CREATE VIEW mylib/myview AS 
  (SELECT DATE(REPLACE(myfield,'-','/')) AS myDateField FROM mylib/myfile)

or if you don't have access to REPLACE function on the version of OS you're
running:

CREATE VIEW mylib/myview AS
  (SELECT DATE(SUBSTR(myfield,1,2) || '/' || SUBSTR(myfield,4,2) || '/'
SUBSTR(myfield,7,4)) AS myDateField FROM mylib/myfile)

That aside, perhaps your alpha format resembles *ISO (YYYY-MM-DD). In that
case, simply casting to DATE may work, i.e.:

CREATE VIW mylib/myview AS
  (SELECT DATE(myfield) AS myDateField FROM mylib/myfile)

HTH

Elvis

Celebrating 10-Years of SQL Performance Excellence

-----Original Message-----
From: midrange-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx
[mailto:midrange-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx]
On Behalf Of Ron Adams
Sent: Sunday, February 25, 2007 12:07 AM
To: Midrange Systems Technical Discussion
Subject: Re: DATE Datatype in SQL View

Currently, it is Alpha 10.

Funny, I was just looking thru some Centerfield's newsletters and the
examples you had in there.



On 2/24/07, Elvis Budimlic <ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

What's your field's current format?

Celebrating 10-Years of SQL Performance Excellence


--
Ron Adams

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.