MySQL Forums
Forum List  »  Triggers

Trap illegal date in trigger
Posted by: Tom Byars
Date: April 04, 2015 01:31AM

I'm importing data from a ms database into mysql. One of the ms columns is an integer type which represents a date in the form (year-1900)*10000+month*100+day. e.g. 20120907 is of the form 1120907.

I want to change this to date(msIntDate+19000000) before it's inserted in to the mysql database. I've tried trapping it in a before insert trigger but mysql raises a invalid date error before the trigger is called. Any way of doing this?

PS I need to be able to import the data from the ms table in the form

select * from msTable

because the msIntDate is spread throughout many different tables which have many columns so it's not just a simple case of importing it as msIntDate+19000000.

Options: ReplyQuote

Written By
Trap illegal date in trigger
April 04, 2015 01:31AM
April 04, 2015 10:22AM
April 06, 2015 03:14AM
April 06, 2015 03:41AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.