2

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)
Omar Einea
  • 2,478
  • 7
  • 23
  • 35
Shrikant
  • 61
  • 1
  • 7

0 Answers0