Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:32:22+00:00 2026-06-06T15:32:22+00:00

I am trying to update a field’s value if a string column is between

  • 0

I am trying to update a field’s value if a string column is between two numbers.

UPDATE SAMPLE.EXAMPLE 
SET modNum = CONCAT(modNum,"26")
WHERE modNum NOT LIKE '%26%' 
  AND (procKey BETWEEN 90000 AND 99123 OR procKey = 77444);

Unfortunately I get an error:

Error Code: 1292. Truncated incorrect DOUBLE value: ‘4123F ‘

I am surprised because when I do a select I get the expected results.

SELECT *
FROM SAMPLE.EXAMPLE 
WHERE modNum NOT LIKE '%26%' 
  AND (procKey BETWEEN 90000 AND 99123 OR procKey = 77444);

Create table statement:

'CREATE TABLE `example` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `modNum` char(4) DEFAULT NULL,
  `procKey` char(8) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1'

Sample Data:

INSERT INTO `SAMPLE`.`EXAMPLE` (`modNum`, `procKey`) VALUES ('42', '99001');
INSERT INTO `SAMPLE`.`EXAMPLE` (`modNum`, `procKey`) VALUES ('42', '9900f');

What can I do to update the columns given my conditions?



To me it looks like a bug. The best I can come up with is to check if the value of procKey is an integer by using regular expressions. I changed my UPDATE statement to be:

UPDATE SAMPLE.EXAMPLE 
SET modNum = CONCAT(modNum,"26") 
WHERE modNum NOT LIKE '%26%' 
    AND procKey REGEXP '^[0-9]+$' 
    AND (procKey BETWEEN 90000 AND 99123 
        OR procKey = 77444);

Please, let me know if there is a better way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:32:24+00:00Added an answer on June 6, 2026 at 3:32 pm

    To me it looks like a bug. The best I can come up with is to check if the value of procKey is an integer by using regular expressions. I changed my UPDATE statement to be:

    UPDATE SAMPLE.EXAMPLE 
    SET modNum = CONCAT(modNum,"26") 
    WHERE modNum NOT LIKE '%26%' 
        AND procKey REGEXP '^[0-9]+$' 
        AND (procKey BETWEEN 90000 AND 99123 
            OR procKey = 77444);
    

    Please, let me know if there is a better way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m trying to update time in datetime field as UPDATE table_name SET col_name=to_DATE('04/02/2012 00:12:00','MM/DD/YYYY
I'm trying to update a field where username = $username UPDATE userinfo SET password
I'm trying to update a field in 2 tables with the same value -
I'm trying to update the value in a MYSQL enum field from PHP via
I am trying to update a field using UPDATE table set field='some_variable' where id=1;
I'm trying to update the value of a field based on a select box
I'm trying to update the value of a field in MySQL with PDO, i've
I am trying to update a field in my app when its tile is
I am trying to update a field in a table with data from another
I am trying to update a field of type spFieldUserValue, you know a, PeoplePicker.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.