Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Posts
    10

    Unanswered: numeric data truncated

    Dear All;
    I am trying to insert some data into mysql table as follow:
    Public aErrorArray(7)
    A1="ABC"
    A2="100"
    A3="DESC"
    A4=6
    aErrorArray = 0
    = SQLSetprop(Nc, 'Transactions', 2)
    = SQLExec(Nc, "INSERT INTO MYTABLE (X1,X2,X3,X4);
    VALUES ('&A1','&A2','&A3','&A4')")
    = Aerror(aErrorArray)

    If aErrorArray(1) = 0
    Sqlcommit(Nc)
    ENDIF

    but it gives me the following error :

    Connectivity error: [MySQL][ODBC 3.51 Driver][mysqld-5.1.23-rc-community]Data truncated for column 'X4' at row 1"
    "[MySQL][ODBC 3.51 Driver][mysqld-5.1.23-rc-community]Data truncated for column 'X4' at row 1"

    If I put the 6 direct in place of '&A4' like this '6' it works fine and it saves the record correct in the table.
    the field type in mysql table is float but I have tried various types it did not work.
    Any solution please, thanks in advance.

  2. #2
    Join Date
    Apr 2008
    Posts
    10

    numeric data truncated

    Dear All;
    I am trying to insert some data into mysql table as follow:
    Public aErrorArray(7)
    A1="ABC"
    A2="100"
    A3="DESC"
    A4=6
    aErrorArray = 0
    = SQLSetprop(Nc, 'Transactions', 2)
    = SQLExec(Nc, "INSERT INTO MYTABLE (X1,X2,X3,X4);
    VALUES ('&A1','&A2','&A3','&A4')")
    = Aerror(aErrorArray)

    If aErrorArray(1) = 0
    Sqlcommit(Nc)
    ENDIF

    but it gives me the following error :

    Connectivity error: [MySQL][ODBC 3.51 Driver][mysqld-5.1.23-rc-community]Data truncated for column 'X4' at row 1"
    "[MySQL][ODBC 3.51 Driver][mysqld-5.1.23-rc-community]Data truncated for column 'X4' at row 1"

    If I put the 6 direct in place of '&A4' like this '6' it works fine and it saves the record correct in the table.
    the field type in mysql table is float but I have tried various types it did not work.
    Any solution please, thanks in advance.

  3. #3
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    &A1 <- is NOT a float value, hence your problem. Why are you trying to insert what appears to be a string into a float column?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    thread merged

    if you don't get a response to your original qyuestion then its fine to post a 'bump' message.

    it may be worthwhoile considerign why you got no response.. it coudl be that the question was asked inthe wrong forum
    it could be you didn't provide enough information
    ir could be there was no one knowledgeable enough around at the rimte
    it could be others couldn't understand your question (although you will usually get a response here indicating that)

    HTH

  5. #5
    Join Date
    Nov 2006
    Location
    Quebec
    Posts
    172
    Maybe you should try to convert all your values in char format since all the values that works are char.

    VALUES (CAST(&A1 AS varchar),...) ???
    Less is more.
    How long is now?
    http://www.lesouterrain.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •