[Omaha.pm] Pick your brain?

Jay Hannah jay at jays.net
Fri Jun 23 13:26:21 PDT 2006


Michael D. Maynard wrote:
> Can I pick your brain for a minute?  I've got a perl script that imports 
> tables from SQL server and inserts them into MySQL.  The script does the 
> inserts to one of two servers depending on the arguments that you give 
> it.  It has been running stably for almost a year.  Recently some 
> changes were made to the tables in the SQL server.  A few fields were 
> added and a few taken away.  The SELECT and REPLACE statements were 
> updated accordingly. 

What is a REPLACE statement? A wacky variation of an UPDATE statement? Does that exist in MySQL, MS-SQL, or both?

> The SQL server is updated twice a day.  Client pushes data to me which I 
> scrub and populate the MySQL database. This is the odd thing.  The first 
> time the script is run after an update of the SQL server, I get errors 
> saying that required fields are empty.  They are not.  If I run the 
> script again, it works fine.  Sometimes it will error on another table, 
> but if I run it enough times and get through all the tables then it runs 
> fine until the next update.  The failed REPLACE statement isn't in the 
> bin log. :-(
> 
> I haven't made any updates to perl, perl modules, SQL server, OS, etc.
> 
> Any thoughts?

Yikes. Are you using DBD::Sybase and freetds to connect to MS-SQL server (that is what I use) or some other combination? Can you tell me exactly what errors you are getting? Can you trap the line of data in the source database that it is complaining about? (RaiseError 0, PrintError 1, + a little loop for error handling to print all the values in the fatal row?)

HTH,

j
in PHX until Sunday night




More information about the Omaha-pm mailing list