RE: Datatype Conversion Within a SQL Statement

"Zabach, Elke" <[email protected]>
Newsgroups gmane.comp.db.maxdb
Message-ID <[email protected]>
Hi,

I do not know why Frank did not receive my mail 6 days ago
( I picked HIS mail out of the junk-folder, maybe the answer could be
found in his),
but I think his solving will result in problems every time the original
date
was the first day of a month.

Therefore, for the second time, I recommend the function SUBDATE, which
(by the way)
is much easier to read and will work even for the first day of a month
and those
days after the 10th.

set <columnname> = subdate (<columnname>, 1)


Elke
SAP Labs Berlin

 

> -----Original Message-----
> From: Frank Reinprecht [mailto:[email protected]] 
> Sent: Mittwoch, 20. Dezember 2006 20:56
> To: [email protected]
> Subject: Re: Datatype Conversion Within a SQL Statement
> 
> Hi List,
> 
> it was, as everytime when nobody answers, too easy ;) After searching
> again in the sqlstudio help I found what I need to solve it. I just
> didn't took the right keywords while searching last time.
> 
> The solution (if somebody else perhaps need this) is:
> 
> update k_sonder_pos set
> <columnname> = Date(
> 	(SUBSTR(<columnname>,1,8)) & '0' &
> 	 SUBSTR(chr(NUM(SUBSTR(<columnname>,9,2)) -1),1,1)
> )
> where
> <columnname> <= '2007-01-31' and <columnname> >= '2007-01-01'
> 
> Greetings,
> Frank
> 
> 
> -- 
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:    
> http://lists.mysql.com/[email protected]
> 
> 
> 

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.