mkahn has asked for the wisdom of the Perl Monks concerning the following question:
I 've got a client who sends me wine data, and I run a script to clean the data before its uploaded.
The Year column is defined in mysql as year(2), meaning it expresses year as a 2 digit number. Which is fine, except for the fact that several vintages use the value NV (no vintage). mysql converts that into 0, so the outoput from a retreived query is 00. Even if I allow null values and replace all the NV instances with ""(nothing), I still get zero in that cell.
I changed the column type to varchar, which solves the NV issue, but now the years in this century are expressed in single digit form.
So I could do a little regex diddy, but that's totally inelegant. There is probably a better way to work with the database.
I'd be pleased to hear your thoughts.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: working with year in mysql
by McDarren (Abbot) on Dec 16, 2005 at 06:47 UTC | |
by bart (Canon) on Dec 16, 2005 at 08:46 UTC | |
|
Re: working with year in mysql
by Kanji (Parson) on Dec 16, 2005 at 06:13 UTC | |
|
Re: working with year in mysql
by Celada (Monk) on Dec 16, 2005 at 18:38 UTC | |
|
Re: working with year in mysql
by TedPride (Priest) on Dec 16, 2005 at 16:37 UTC |