擅长:python、mysql、java
<p>从<a href="https://code.google.com/p/pyodbc/wiki/StoredProcedures" rel="noreferrer">pyodbc documentation</a></p>
<blockquote>
<p>To call a stored procedure right now, pass the call to the execute method using either a format your database recognizes or using the <a href="http://msdn.microsoft.com/en-us/library/ms131685.aspx" rel="noreferrer">ODBC call escape format</a>. (The ODBC driver will then reformat the call for you to match the given database.)</p>
<p>For SQL Server you would use something like this:</p>
</blockquote>
<pre><code># SQL Server format
cursor.execute("exec sp_dosomething(123, 'abc')")
# ODBC format
cursor.execute("{call sp_dosomething(123, 'abc')}")
</code></pre>
<p>所以叫你的程序</p>
<pre><code>id_ = 'test'
pw = '12345'
depart = 'none'
class_ = 'GM'
name = 'name'
birthday = 'None'
grade = 3
subgrade = 2
sql = 'exec [my_database].[dbo].[my_table](?, ?, ?, ?, ?, ?, ?, ?)'
values = (id_, pw, depart, class_, name, birthday, grade, subgrade)
cursor.execute(sql, (values))
</code></pre>