Hi,
 
I'm trying to insert date type values in SQL Server 7.0, but I always
get the next error:
 
DBD::ODBC::st execute failed: [unixODBC] Msg 8115, Level 16, State 2,
Server PROSDK01, Line 1

The table in SQL Server is defined as:
create table pruebas (char codigo not null, char valor not null,
datetime fecha null);
 
I use the next perl code :
 
my($dbh) = DBI->connect ("dbi:ODBC(RaiseError=>1, Taint=>1,
AutoCommint=>1):DSN=<DSN>", "user", "pwd");
 
my($transaction) = $dbh->prepare("INSERT into PRUEBAS(CODIGO, VALOR,
FECHA) VALUES(?, ?, CONVERT(datetime, $now)");
$transaction->bind_param(1, '10101', {TYPE => SQL_CHAR});
$transaction->bind_param(2, '20202', {TYPE => SQL_CHAR});
$transaction->execute;
 
I have also tried with:
 
my($transaction) = $dbh->prepare("INSERT into PRUEBAS(CODIGO, VALOR,
FECHA) VALUES(?, ?, ?)");
$transaction->bind_param(1, '10101', {TYPE => SQL_CHAR});
$transaction->bind_param(2, '20202', {TYPE => SQL_CHAR});
$transaction->bind_param(3, $now, {TYPE => SQL_TYPE_TIMESTAMP});
$transaction->execute;
 
Perl version is 5.8, DBI version is 1.34 and DBD::ODBC version is 1.05. 
ODBC Driver is freeTDS v0.61.
OS from I have running perl is Linux Red Hat 7.3
 
Thanks for your help
Fernando

Reply via email to