I have this code:
with connections["mssql_database"].cursor() as cursor: sql = "EXEC SaveActivity @id_workplace=?, @personal_number=?, @id_activity=?" params = (id_workplace, personal_number, id_activity) cursor.execute(sql, params) TypeError: not all arguments converted during string formatting
When I try
cursor.callproc("SaveActivity", [id_workplace, personal_number, id_activity])
AttributeError: 'pyodbc.Cursor' object has no attribute 'callproc'
This errors occurs because the parameters you are passing don't match the defined types on the database side in SQL Server.
@id_activity all integers? If so, are the Python variables
id_activity all integers? What are the values of the Python variables? If any of them are
None, you'll need to make sure that the corresponding database variable allows