|Pathologically Eclectic Rubbish Lister|
Using perl dbi and Sybase IQ doing insert with placeholder getting datatype errorby ckbbkc (Novice)
|on Sep 10, 2015 at 16:32 UTC||Need Help??|
ckbbkc has asked for the wisdom of the Perl Monks concerning the following question:
I have some code that I have run against MS SQL Server and Sybase ASE successfully. When I try to run it against a Sybase IQ server, there is a problem.
A temp table is created with a single varchar(25) field. Then a list of numbers are read from a file, leading zero's are pre-pended and I attempt to insert them one by one into the temp table.
The error returned is:DBD::Sybase::st execute failed: Server message number=21 severity=14 state=0 line=0 text=SQL Anywhere Error -1000187: Unable to implicitly convert column 'PAT_MRN_ID' to datatype (varchar) from datatype (integer).
The code is:
I don't know much about the odbc drivers - I think it is odd that the error says "SQL Anywhere", but I am using the connection information that I was given. I have figured out a workaround - creating two columns in the temp table, inserting the numbers converted to varchar, then updating the values to the second column in the temp table. But really, I want to understand why it is attempting to insert $mrn as a numeric rather than a string.
Any help would be greatly appreciated!!