troubleshooting Question

insert int into mysql table with null values

Avatar of dmontgom
dmontgom asked on
DatabasesMySQL ServerSQL
3 Comments3 Solutions2502 ViewsLast Modified:
Hi,

I worte a python script to insert data into a mysql data file.  Here is an example of on insert statement...

INSERT INTO temptable (preferred_term_code, feature_code, feature_desc, feature_rank, feature_unit_code) VALUES (1229,"01","Material",,1)

The second to the last field is null and defined as an int..

However, I get errors inserting the record.  If I switch the data type to VARCHAR(100) then it works fine.

Here is my create statement for the table...

CREATE TABLE temptable (preferred_term_code INT,feature_code VARCHAR(100),feature_desc VARCHAR(100),feature_rank INT,feature_unit_code INT)

What is going on?  And how do I insert the record?

Thanks

ASKER CERTIFIED SOLUTION
Joe Wu
Developer | Solutions Architect | CTO

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros