Re: DBDATE / DBMONEY in SQL =?ISO-8859-1?Q?=E4ndern?= ??
Posted in 2007
On Tue, 2007-07-10 at 14:19 +0100, Marco Greco wrote:
>
> Carsten Haese wrote:
> > On Tue, 2007-07-10 at 09:39 +0000, hoffiman@googlemail.com wrote:
> >> Hallo zusammen,
> >>
> >> ich möchte ein Daten in die Datenbank landen - in den Daten ist das
> >> Datum mit 2007-07-10 angegeben.
> >>
> >> Ich möchte die Daten aber nicht mit dbload sondern mit dem Befehl load
> >> laden.
> >>
> >> ist es möglich das Datumsformat unter SQL zu ändern.
> >>
> >> Wenn ich die Enviorment Variable DBDATE ändere dann gilt das gleich
> >> für die ganze Season und ich muss unter Unix laden.
> >>
> >> Danke und Gruß
> >>
> >> Matthias
> >
> > [Note that this list is usually in English. Your chances of reaching a
> > knowledgeable person increase dramatically if you restate your question
> > in English.]
> >
> > Mir ist keine Möglichkeit bekannt, das Datumsformat durch einen
> > SQL-Befehl zu verändern. Eine Möglichkeit wäre es, die Daten zuerst in
> > eine Hilfstabelle zu laden. Die Hilfstabelle würde identisch zur
> > Zieltabelle aussehen, außer das Date-spalten durch Char(10)-spalten
> > ersetzt sind. Danach kann man dann die Daten in die Zieltabelle
> > übertragen und die Datumsspalten mit mdy(x[6,7],x[9,10],x[1,4]) in
> > richtige Daten übersetzen.
> >
> > In English:
> >
> > I'm not aware of a way to set the date format with an SQL command. One
> > possibility would be to load the data into an auxiliary table that is
> > identical to the target table except that date columns are replaced by
> > char(10) columns. You can then transfer the data to the target table and
> > translate the date columns with mdy(x[6,7],x[9,10],x[1,4]) into real
> > dates.
> >
> > Hope this helps,
> >
> Dates and datetimes have their own storage format which is independent of any
> string representation.
> You have several options to format string representation of dates, from the
> DBDATE environmental variable to the TO_CHAR function.
I fail to see how that helps the OP. He wants to get the date from the
string, not the string from the date, and for reasons he doesn't make
entirely clear, he doesn't want to set the DBDATE variable.
--
Carsten Haese
http://informixdb.sourceforge.net