If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
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, 11: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, 11: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, 05:01
aschk aschk is offline
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old 04-09-08, 05:13
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
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, 15: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

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