Is there an option to prevent MySQL automatic conversion?

Asked 2 years ago, Updated 2 years ago, 43 views

Hello, I am posting a question because there was a problem with mySQL query.

select ID,membername,SubID from fund_member where SubID='SP107' ;

When you search in , you will get the following results.

1 row in set, 1 warning (0.00 sec)

I searched for SubID with SP107, but it came out with the result of 0 so I checked the warning

A warning like this occurred, and when I checked the table structure, SubID was a numeric type, not a letter

It was a field. Because MySQL automatically transformed this problem.

It is judged to be a case that occurred, but MySQL does not convert to automatic type and does not warn you

Is there an option to spray errors?

mysql

2022-09-22 20:45

1 Answers

They say that you can set the SQL in strict mode.

set @@GLOBAL.sql_mode  = "STRICT_ALL_TABLES";
set @@SESSION.sql_mode = "STRICT_ALL_TABLES";

Or

SET sql_mode = '';

Please change the setting to .

A detailed description of Strict mode is available in Server SQL Modes - Strict.


2022-09-22 20:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.