in reply to Using perl dbi and Sybase IQ doing insert with placeholder getting datatype error

You could try CAST

my $insertMRNQuery = qq{ insert #mrns (PAT_MRN_ID) values (CAST(? AS VARCHAR)) };

or STRING and add the leading zeros in SQL

my $insertMRNQuery = qq{ insert #mrns (PAT_MRN_ID) values (RIGHT(STRING('0000000000',?),10)) };
poj

Replies are listed 'Best First'.
Re^2: Using perl dbi and Sybase IQ doing insert with placeholder getting datatype error
by ckbbkc (Novice) on Sep 10, 2015 at 22:03 UTC

    Thank you! These solutions work. I particularly like the (RIGHT(STRING('0000000000',?,10)). The cast will remove the leading zeroes on $mrn. I think the prepare just isn't getting the column datatype from Sybase IQ whereas it was with MSSQL Server and Sybase ASE.

    Thank you very much!!!