Subject: | selectcol_arrayref() fails with SQL-HY104 against SQL Server 2000 (Invalid precision value) |
selectcol_arrayref() fails with Invalid precision value (SQL-HY104)
against SQL Server 2000 for certain queries. The initial query that
showed the problem was quite complex. I was able to simply it down to
the following code though upon further simplification (say just the
inner query) the bug disappeared.
my $dbh = DBI->connect("dbi:ODBC:testdb", '', '',
{AutoCommit => 1, RaiseError => 0} );
if (!defined($dbh)) { die "Unable to connect to database."; }
my $sql = <<'DONE';
select top 1 st_id from st_name
where st_specificity = 'acc'
and st_parent_id = (
select top 1 st_id from st_name
where st_specificity = 'taxon' and st_name = ?
)
DONE
my $p = $dbh->selectcol_arrayref($sql, undef, 'Blahblahblahblah');
FWIW, the st_name.st_name column is a varchar(64) and I am binding a
string (shorter than 64 characters) to it when it fails. The _id columns
are all integer primary keys. The database is big and it would be some
effort to strip things down further though if it were needed for further
troubleshooting I might be able to construct a complete example, i.e.
with table creation and population statements demonstrating the problem.
I am seeing this problem under ActivePerl 5.10 (both builds 1005 and
1007) running on XP SP3 boxes, fully patched. I do not see this issue
using DBD-ODBC 1.16 package that ships with the 1005 build when I remove
the 1.23 site version. Also I downloaded 1.22 from CPAN and manually
compiled and installed it in the site library and again do not see the
problem. It seems to be a new problem in the 1.23 version.