The following script dies, with the error message "DBD::ODBC::st
execute failed: [Microsoft][ODBC SQL Server Driver]Invalid character
value for cast specification (SQL-22018)(DBD: st_execute/SQLExecute err=-1)".
Can anyone tell me why? The database handle is a good database
handle. The fields ExpirationDate and DateGenerated are of type
smalldatetime. I'm using DBI version 1.48 (which appears to be the
latest) with ActiveState's ActivePerl 5.8.7 build 815. It doesn't
make any difference (of course, it shouldn't) if I assign $numDays as
"my $numDays = '5'; ". However, if I replace the '?' with a 5
directly and don't pass any value to execute(), it runs just fine.
use strict;
use DbConn;
my $db = getDbConn('ncnewhanover');
my $numDays = 5;
my $sth = $db->prepare(<<"");
update IEPReports
set ExpirationDate = dateadd(day,?,DateGenerated)
where ExpirationDate is null
$sth->execute($numDays);
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs