Long shot question for any mysql wizards out there...
# cfml-general
s
Long shot question for any mysql wizards out there. We have a varchar(12) column in a table that has a value of ELIZ19580804. We are trying to insert that value into another table with a column defined as varchar(25). MySQL throws an error "1292 truncated incorrect double value for 'ELIZ19580804'". If I change and update the value to say ZZZZ19580804, it throws the same error with the original value of ELIZ19580804. The select query that returns just this row is: SELECT c_spid, 191, CAST(c_uid AS CHAR(12)), 'CTB Plan 191', NOW(), c_coid, 1, c_emid, NOW() FROM _colonial WHERE c_spid IS NOT NULL AND c_uid IS NOT NULL AND NOT EXISTS (SELECT 1 FROM sponsorasset WHERE sa_bpid=191 AND sa_spid=c_spid AND sa_custom1=c_coid); The insert portion is: INSERT INTO sponsorasset(sa_spid, sa_bpid, sa_account, sa_desc, sa_added, sa_custom1, sa_ctb_upd_pending, sa_ctb_emid, sa_dla) That fails with that error message. Now for extra strangness, if I explicitly insert just that one row adding AND c_id = 28 to the select it works fine and inserts the value that I manually set : ZZZZ19580804
m
if i were to guess by the message, i'd say your columns are out of order between the insert into declaration and the values being inserted, where one of the strings is landing on a double
👍 1
☝️ 2
d
Good thought, but I don't see how that could explain the "extra strangness" result.
s
We just did a bunch more testing and still no clear answer. Even in the source table, changing the c_uid value from ELIZ19580804 to XXXX19580804, deleting the index (and we also recreated the table and reloaded the data), the error about the truncated double still shows the old value of ELIZ19580804. We even created a 2nd table to process from, and it did the same there. Adding the PKID to the select statement makes the whole query work fine, as does adding the values to a straight insert statement with no select involved.
b
Hey Steve, As a help whenever you query multiple tables, it is always good to scope ALL the variables. For example, instead of sa_bpid = 191, use _colonial.sa_bpid = 191 I can't tell from your code if it would fix your issue, but it will remove potential problems.
g
I am pretty sure that your issue is the missing PK from the list of values. Add the column names into your insert statement and I am all-but certain that your issue will disappear..
Copy code
INSERT INTO sponsorasset(columnName1,columnName2,...)
VALUES(sa_spid,sa_bpid,,...)