I have values in few different variables and one of them stores date. When I checked data type in Python it shows Str. I added Convert(datetime,'{}',102) in my Insert statement to Insert this field in Database table since this field datatype in table is Date. This works fine when this variable has data.
Now, for some records this field is blank so Python variable holds None. How do I handle this? I want to insert NULL in this scenario.
Note-> I have this code inside for loop so I am inserting records one by one. This is why for some iterations variable might have actual date value and for some it might have None.
Current Code->
"Insert into table (col1,col2,col3) values ('{}',Convert(datetime,'{}',102),'{}')".format(var1,var2,var3)