Re: datetime month question
- From: "Tony Rogerson" <tonyrogerson@xxxxxxxxxx>
- Date: Mon, 8 Jun 2009 18:45:45 +0100
Next the ISO-8601 convention is "yyyy-mm-dd" and not the dialect you
showed. Learn to write code to Standards; it will save you and the
poor bastards that have to maintain code a lot of problems.
Yet again you ignorantly ignore product experts on here when they tell you not to use yyyy-mm-dd because of its incompatibility with regional installs.
yyyymmdd is iso standard and compatible across regions.
dont be so dam unprofessional and stop promoting incorrect information and very bad advice that in your own words could kill somebody.
"--CELKO--" <jcelko212@xxxxxxxxxxxxx> wrote in message news:18426269-c425-4066-ba47-3b945fc89164@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have 2 datetime fields [sic] StartDate and EndDate in the format 21/01/2009 00:00:00 and 1 varchar field [sic] month in the format 'Jan-09', 'Feb-10' etc. <<
Columns are not fields; fields have a format while columns are
abstract. We don't care about internal storage. DB2 holds dates in a
totally different way than SQL Server, for example.
Next the ISO-8601 convention is "yyyy-mm-dd" and not the dialect you
showed. Learn to write code to Standards; it will save you and the
poor bastards that have to maintain code a lot of problems.
How would I convert these varchar month representations (Mar-09 etc) into meaningful dates? <<
The procedural mindset approach would be to use row at a time
proprietary function calls; there is a good library in SQL Server for
this
The set-oriented approach would be to create an auxiliary table keyed
on the strings and do a join that can be optimized. You might want to
look up "Calendar tables" as it is a common SQL programming idiom.
As an aside, MySQL has a dialect convention that zeros in the month or
day positions represent a range. I.e. your 'Mar-09' is shown as
'2009-03-00' and the entire year is '2009-00-00' in their dialect.
.
- Follow-Ups:
- Re: datetime month question
- From: --CELKO--
- Re: datetime month question
- References:
- datetime month question
- From: Mike P
- Re: datetime month question
- From: --CELKO--
- datetime month question
- Prev by Date: Re: Using NOT IN in table field
- Next by Date: Re: Using NOT IN in table field
- Previous by thread: Re: datetime month question
- Next by thread: Re: datetime month question
- Index(es):
Loading