in reply to Re^6: Issue while inserting Thai Characters into Database..
in thread Issue while inserting Thai Characters into Database..

Don't do that, make the whole parameter the string "{ts 'MYDATEHERE'}". You cannot stick a parameter in the middle of the ODBC date/time syntax, the parameter needs to be the whole thing.

my $sql= q/INSERT INTO BK_imageINfo (BusDate) VALUES (?)/; . . . execute(q/{ts '2010-01-20 00:00:00'}/);

Replies are listed 'Best First'.
Re^8: Issue while inserting Thai Characters into Database..
by ajaykumarb (Initiate) on Jan 22, 2010 at 04:35 UTC
    I tried several options with timestamp. But i got "MicrosoftODBC SQL Server DriverInvalid precision value (SQL-HY104)" error message.
    But below code with date and no timestamp is working fine without any issues.
    my $sql= "INSERT INTO BK_imageINfo (BusDate) VALUES (?)"; . my $bdate = "2010-01-20"; $sth->execute("{d '$bdate'}");
    Through my script, now i am able to insert date as well as Thai Characters to SQL Server database without any issues...

    Thanks much for your extensive support Martin.

    Thanks,
    Ajay

      I now realise you probably mean an actual timestamp column as opposed to a datetime column - yes? timestamp columns are special in SQL Server and you generally cannot insert into them but you can set a DEFAULT on the column to get the current time. If you have a column of type timestamp you should not be inserting into it - if you need to then make it a datetime instead and use the ODBC "ts" syntax.

        Sorry for the confusion Martin. Actually it is datetime datatype in SQL Server and i tried inserting a value "2010-01-22 12:00:00 AM" as execute("ts '$bdate'"); but i ended out with Precision error.