马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import pymssql
PL ='ooA5'
Stock = '1,2,3,4'
conn = pymssql.connect(server='AA', user='sa', password='FF', database='CC',
charset='utf8')
sql = "select a.productID,fullName,b.storageName," \
"convert(int,isnull(d.orderAmount,0)) as orderAmount," \
"convert(int,isnull(d.roadamount,0)) as roadamount," \
"convert(int,isnull(d.amount,0)) as amount," \
"convert(int,isnull(d.money,0)) as money " \
"from EIM_BSS_Basic_Products a cross join " \
"EIM_BSS_Basic_Storage b join " \
"EIM_BSS_Stat_ProductStorage c on a.productID=c.productID Left join " \
"EIM_BSS_Stat_ProductSubStorage d on a.productID=d.productID and b.storageID=d.storageID Left join " \
"EIM_BSS_Basic_ProductCategories e on a.productCategoryID=e.productCategoryID Left join " \
"EIM_BSS_Basic_ProductCategories f on left(a.productCategoryID,4)=f.productCategoryID " \
"where left(a.productCategoryID,4) = %s and b.storageid in (%s)" \
"order by fullName ,left(a.productCategoryID,4),a.productCategoryID,a.productid,b.storageID"
cursor0 = conn.cursor() # 创建游标0
cursor0.execute(sql,(PL,Stock)) # 执行sql
sqlData = cursor0.fetchall()
cursor0.close()
conn.close()
print(sqlData)
谁能帮忙解释下为什么一直错吗?放入一个参数就可以,2个就不行了。 |