Re: DBDATE / DBMONEY in SQL =?ISO-8859-1?Q?=E4ndern_=3F=3F?=
Posted in 2007
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.
--
Ciao,
Marco
______________________________________________________________________________
Marco Greco /UK /IBM Standard disclaimers apply!
Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
4glworks http://www.4glworks.com
Informix on Linux http://www.4glworks.com/ifmxlinux.htm