in reply to perl dates into string into SQL

See the thing is if the values in the original database were NUll, it was setting the date to 0-0-0, which is invalid in SQL. So I did a test to see if the original values are NULL, then set the variable to ""(blank) which converts to 1900-01-01 00:00:000 which is a good date for SQL.

Replies are listed 'Best First'.
Re: Re: perl dates into string into SQL
by iburrell (Chaplain) on Sep 17, 2003 at 18:18 UTC
    Don't do that. If the original values are NULL, then you should insert NULL into the new field. This is accomplished by inserting undef instead of a string. Having a bogus value "1900-01-01" is dangerous because it breaks the assumptions people and code make about valid values.
Re: Re: perl dates into string into SQL
by bear0053 (Hermit) on Sep 17, 2003 at 17:46 UTC
    can u provide a printout of the sql state that perl providing. a valid sql date is: 9/16/2003 5:23:49 PM try making it this format