this will help You've got multiple problems here. One, as pointed out in the comments, is that INNER JOIN cannot join to NULL (no join can, actually, but read on..) so where, for example you write in your SQL:
INNER JOIN MaritalStatus AS m ON m.MaritalStatusDesc = @maritalStatusDesc
I think the issue was by ths following , MySQL by default attempts to coerce invalid values for a column to the correct type. Here, the empty string '' is of type string, which is neither an integer nor NULL. I suggest taking the following steps: Change the query to the following: INSERT INTO foo (bar) VALUES (NULL); Enable strict mode in MySQL. This prevents as many unexpected type and value conversions from occurring. You will see more error messages when you try to do something MySQL doesn't expect, which helps you to spot problems more quickly.
Dealing with empty data while inserting text data in MySql via python script