Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > MySQL > numeric data truncated

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-06-08, 12:24
T.ALKATHIRI T.ALKATHIRI is offline
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old 04-06-08, 12:31
T.ALKATHIRI T.ALKATHIRI is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 04-09-08, 06:01
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 734
&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?
Reply With Quote
  #4 (permalink)  
Old 04-09-08, 06:13
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 5,459
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
Reply With Quote
  #5 (permalink)  
Old 04-09-08, 16:08
ortho ortho is offline
Registered User
 
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On