Emenalo Onyekachi
Emenalo Onyekachi

Reputation: 9

Incorrect DECIMAL value when inserting MySQL 1

Name Type

price decimal(7,0)

INSERT INTO products (uid, item_code,item_name, brand_name,model_number,weight,dimension,description,category,quantity,price,imagename) 
VALUES (1, '01','Lenovo','Lenovo laptop','qwqeiu145','50kg','5x9','Lenovo is the best','Computers & Accessories','2','$250.0000','lenovo');

THIS IS THE ERROR

1366 - Incorrect decimal value: '$250.0000' for column 'price' at row 1

Upvotes: 0

Views: 4068

Answers (2)

Death-is-the-real-truth
Death-is-the-real-truth

Reputation: 72299

You need to Change

$250.0000

To

250.0000

because it's decimal datatype. You can only insert numbers in it, while $ is a string

Upvotes: 4

Marco Migozzi
Marco Migozzi

Reputation: 11

In decimal fields you can only insert numbers, you just need to remove the $.

Take care u declared the field with 0 decimals, any number after the dot will be ignored.

Upvotes: 0

Related Questions