I want to execute an SQL script against a MSSQL server. In the script I have created table variable by selecting data from a table, then get the data from the variable. But it returns an array with no values.
SQL:
DECLARE @ProductTotals TABLE
(
ProductID int,
Revenue money
)
INSERT INTO @ProductTotals (ProductID, Revenue)
SELECT ProductID, SUM(UnitPrice * Quantity)
FROM [Order Details]
SELECT * FROM @ProductTotals
Python:
data = connection_to_database.execute(sqlFile)
for i in data:
print(i)