RE: Datatype Conversion Within a SQL Statement

"Zabach, Elke" <[email protected]>
Newsgroups gmane.comp.db.maxdb
Message-ID <[email protected]>
Frank Reinprecht wrote:
> 
> Dear readers,
> 
> I'm using sapdb 7.4 (I know it is a little bit old, but it 
> works for me)
> on a windows 2000 server. I made a mistake and filled the 
> delivery date
> of a customer-position with a wrong value. It was the wrong year.
> So I used the following statement for correcting the year 
> from 2006 to 2007.
> 
> update k_sonder_pos set liefertermin = Date('2007' &
> SUBSTR(liefertermin,5,10)) where
> liefertermin <= '2006-01-31' and liefertermin >= '2006-01-01'
> 
> This works as I expected very fine. But I now have the 
> problem, that the
> dates are shifted by one day. The 01.01.2006 is a sunday, and not like
> the 01.01.2007 a monday. So I want decrease all the dates a day.
> 
> I tried different things, but without a conversion from 
> string to number
> and reverse I'm not able to solve it, I guess. Is there any 
> possibility
> to do so?

update k_sonder_pos set liefertermin = subdate (liefertermin, 1)
will help, but pay attention to the fact that
January, 1st of 2007 will become last day of 2006. 
see
http://dev.mysql.com/doc/maxdb/en/ac/bdceebbb4a11d2a97100a0c9449261/fram
eset.htm

Merry Christmas and good luck with your 'liefertermin'
  Elke
SAP Labs Berlin

> 
> If anybody can help me out with this, please don't hesitate. I'm
> thankfully for any hints!
> 
> Again thanks in advance!
> 
> 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.