Re: Formatting dates on insert or update - Help required please
- From: --CELKO-- <jcelko212@xxxxxxxxxxxxx>
- Date: Wed, 08 Aug 2007 06:51:49 -0700
the record [sic] in the format dd-mmm-yyyy <<Where because ii_date_format is set to Multinational4, the dates thus inserted are in the form dd/mm/yyyy. Is there any simple way of formating the dates so that it is inserted into
This is one of the many differences between rows and records. A
column in a row has a data type and domain, while fields do not.
Temporal data has an internal representation that has nothing to do
with the display. In fact the **only** format allowed in Standard
ANSI/ISO SQL is "yyyy-mm-dd" and that is all you should be using.
Using those local format is a total violation of a tiered architecture
and good SQL programmers avoid them. Let the application programmers
worry about display; we are in charge of data and we follow
standards!
That said, another trick for validation of input strings is to set up
a table with your various formats and do a look-up to convert them.
Usually a 100 years is enough. Uses an OUTER JOIN to find invalid
dates in either format.
CREATE TABLE FixBadDates
(sql_date CHAR (10) NOT NULL,
bad_date CHAR (10) NOT NULL,
etc)
INSERT INTO FixBadDates VALUES ('2007-01-01', '01-jan-07', ..);
The JOIN to the FixBadDates table can be faster than using row at a
time string manipulations that cannot get to an index or hash. And
this is portable, too.
.
- Follow-Ups:
- Re: Formatting dates on insert or update - Help required please
- From: s . anderson . au
- Re: Formatting dates on insert or update - Help required please
- Prev by Date: Re: Formatting dates on insert or update - Helprequired please
- Next by Date: Re: Formatting dates on insert or update - Help required please
- Previous by thread: Re: Formatting dates on insert or update - Helprequired please
- Next by thread: Re: Formatting dates on insert or update - Help required please
- Index(es):
Relevant Pages
|