我正在研究从sql查询保存数据。你知道吗
我的代码运行良好,但它只返回查询的第一个结果数据集。你知道吗
例如,如果我有以下查询:
SELECT * FROM Table1
GO
SELECT * from Table2
或者
SELECT * FROM Table1
SELECT * FROM Table2
我只需要返回表2中的数据。你知道吗
数据库:Microsoft SQL Server 2017
datasets = []
with open('protected_script.sql', 'r') as protected_script:
cursor = connection.cursor()
cursor.execute(protected_script.read())
datasets.append(cursor.fetchall())
目前没有回答
相关问题 更多 >
编程相关推荐