相关疑难解决方法(0)

调用存储过程python

我正在编写一个脚本来提取/更新MsSQL服务器,我可以让我的一个存储过程调用工作但不是我在updateDB函数中的第二个.这是我的代码脚本运行正常没有错误代码

import pyodbc 
import json
import argparse
import cgi, cgitb


#GLOBALS
    BUILDCODE = " "
    deptCODE = 0
    bldgCODE = " "
def getCodes(conn, building, department):
    #just for testing
    departmentt = 'COMPUTER SCIENCE'
    buildingt = 'PEARCE HALL'


    #geting the building code from db
    cursorBuild = conn.cursor()
    cursorBuild.execute("select * from dbo.building where name = '%s'" % buildingt)
    bldgRow = cursorBuild.fetchall() 
    cursorBuild.close()
    bldgCode = bldgRow.pop(0)

    global bldgCODE
    bldgCODE = bldgCode.code


    #getting the dept code
    cursorDept = conn.cursor()
    cursorDept.execute("execute dbo.GetCode_ByDepartment @department = '%s'" …
Run Code Online (Sandbox Code Playgroud)

python sql-server stored-procedures pyodbc

8
推荐指数
2
解决办法
4万
查看次数

标签 统计

pyodbc ×1

python ×1

sql-server ×1

stored-procedures ×1