Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

MySQL Statement Problem (incorrect DOUBLE value)

Contributor ,
Oct 25, 2009 Oct 25, 2009

Hi All,

The line below adds a comma and text to the end of the varchar field in MS SQL...

UPDATE thetable

SET

thefield = thefield+','+'#trim(Form.newitem)#'

Where id = 1

...  but errors in MySQL 5 ...

Error Executing Database Query.

Data truncation: Truncated incorrect DOUBLE value: ','

BTW: I tried: thefield = thefield & ',' & '#trim(Form.newitem)#' --- but still errors out

Q: Is there  a better way to write this statement for MySQL so it won't have an error?

TOPICS
Database access
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 25, 2009 Oct 25, 2009

Are you sure the field is varchar?  Your error message suggests it's numeric.

Is there a better way?  Probably.  Why are you appending a comma plus new text to an existing value in the first place?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 27, 2009 Oct 27, 2009

Hi Dan,

thefield is a varchar.

- i want the contents like :

2,1,44,234,5,6,23,108 etc...

it's easy when you say...

thefield = thefield+ .... cause you can add to the field right there without doing another search query first (to get contents)

Any Ideas how to better write this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 27, 2009 Oct 27, 2009
LATEST

Does MySQL support + as a string concatenation operator?  Or is it for performing addition on numerics?

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources