I am using pymssql to make database calls to a SQL 2005 database. I want to pass parameters to a stored procedure. I am having a hard time getting the correct syntax for that. Here is what I have for calling a procedure with no parameters:
import _mssql
connection = _mssql.connect(server='myserver', database='mydatabase', trusted=True)
connection.execute_query('storedProcedureName')
Suppose I wanted to set the @Id parameter to 1. How would I do that? The following lines do not work. The docs are unclear as to how the params are structured.
connection.execute_query('storedProcedureName', {'@Id':'1'})
connection.execute_query('storedProcedureName', '@Id=1')
connection.execute_query('storedProcedureName', ('@Id', '1'))