in reply to Inserting to a bigint data type in Sybase using prepare statements

Implicit conversion from datatype 'VARCHAR' to 'BIGINT' is not allowed. Use the CONVERT function to run this query.

Try an explicit conversion

my $insert_sth = " INSERT INTO some_table ( transaction_id, ccn_masked, cardholder_name, exp_month, exp_year,card_type, token_id ) VALUES (?, ?, ?, ?, ?, ?, CONVERT(BIGINT,?) )";
poj
  • Comment on Re: Inserting to a bigint data type in Sybase using prepare statements
  • Download Code

Replies are listed 'Best First'.
Re^2: Inserting to a bigint data type in Sybase using prepare statements
by j_ochoa (Novice) on Jul 07, 2017 at 13:23 UTC

    Hi poj,

    I have also tried that, but in that case I was getting this error

    <Couldn't prepare statement: Server message number=12828 severity=16 state=1 line=1 server=DEVEL1 procedure=DBD3 text=The datatype of a parameter marker used in the dynamic prepare statement could not be resolved.

    BR

    JO

      How about using INSERT...SELECT instead of INSERT...VALUES? It might be legal in that statement instead.

      What version of Sybase, Perl and DBD::Sybase are you using ?

        Hi poj,

        these are the versions:

        Perl 5.14

        DBD::Sybase 1.15

        Sybase: Adaptive Server Enterprise/15.7.0/EBF 22644 SMP SP52

        Thanks!