Invalid SQL data type (0) (SQLBindParameter)')

Viewed 67

I am trying to insert Pandas Dataframe to SQL Table using PYODBC Package. But when I run the code it says

Error: ('HY004', '[HY004] [Microsoft][ODBC SQL Server Driver]Invalid SQL data type (0) (SQLBindParameter)')

The column types are ok.

Following are the details

Code

for index, row in final_df.iterrows():
 print(row)
 cursor.execute("INSERT INTO CourseOutline ([ActivityTypeID] ,[ActivityID],[Sequence],[CourseTypeID] ,[Duration], [MinistryCode] ,[FGCCode] ,[Percentage],[ModuleID] ,[PageNo]) values(?,?,?,?,?,?,?,?,?,?)", final_df.ActivityType, final_df.DBID,final_df.Seq,final_df.CourseType,1,'MinistryCodes','FGCCodes',final_df.Percentage,final_df.Module,final_df.PgNo)

 cnxn.commit()
cursor.close()

dataframe column types Dataframe column Types

SQL Column types SQL Column Types

First 3 Records of dataframe

0 Answers
Related