Forum Discussion

SagarB's avatar
SagarB
Frequent Visitor
2 years ago
Solved

Stored procedures with parameters in a Direct Query connection

How to get data from a SQL-server by using stored procedures with parameters in a Direct Query connection?

Facing Error (Microsoft SQL: Incorrect syntax near the keyword 'EXEC') 
I've tried using Power Query's advanced editor and creating new parameters still facing the same error, but I'm wondering if there are any other methods I could try.

  • SagarB 

    CREATE VIEW MyView AS
    SELECT * FROM MyTable WHERE Column1 = 'Value1';

    or use Query Folding by adding extra steps in using M Language

    #"Filtered Rows" = Table.SelectRows(Sales, each [SaleDate] >= #date(2023, 1, 1) and [SaleDate] <= #date(2023, 12, 31))

5 Replies