On Mon, 24 Mar 2003 14:56:24 +0100 "Illera, Fernando" <[EMAIL PROTECTED]> wrote:

> my($now) = time();
> my($transaction) = $dbh->prepare("INSERT into PRUEBAS(CODIGO, VALOR,
> FECHA) VALUES(?, ?, CONVERT(datetime, ?))");
> $transaction->bind_param(1, '10101', {TYPE => SQL_CHAR});
> $transaction->bind_param(2, '20202', {TYPE => SQL_CHAR});
> $transaction->bind_param(3, '$now',  {TYPE => SQL_CHAR});
> $transaction->execute;
> 
> But it fails with next error message:
> 
> DBD::ODBC::st execute failed: [unixODBC] Msg 241, Level 16, State 1,
> Server PROSDK01, Line 1
> Syntax error converting datetime from character string.
>  (SQL-HY000)(DBD: st_execute/SQLExecute err=-1) at
> ./sapp_load_tarificacion_v1.0.0.pl line 118.
> 
> Which could be the problem?

See the last sentence in the paragraph below.

> -----Mensaje original-----
> De: Michael A Chase [mailto:[EMAIL PROTECTED]
> Enviado el: lunes, 24 de marzo de 2003 14:20
> Para: Illera, Fernando; [EMAIL PROTECTED]
> Asunto: Re: Problem when insert date value in SQL Server

> Is the value in $now properly quoted?  If possible, it would be better
> to use a VARCHAR or CHAR placeholder in that location.  Make sure the
> string is properly formatted for CONVERT() to convert.

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to