Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

SQL stored procedures in DirectQuery mode

Hi there,

I have read the comments on the relevant PBI forums about calling SQL stored procedures in DirectQuery mode, but it's not working for me. Could you please assist me validate the following syntax with an example for connecting a stored procedure in DirectQuery mode? Many Thanks.

select *
openrowset('SQLOLEDB','SERVER=SERVERNAME;Trusted_Connection=yes;',' set fmtonly off;


@StartDate=''2023-01-01'' ,

@EndDate=''2023-01-04'' ')

Frequent Visitor

Hi @amitchandak, Thanks for sharing the information. I understand that we won't be able to pass parameters to stored procedures, and we can't execute them in direct query mode. We can however, create table valued functions which give us the ability to use table variables and perform other functions that are more complex in nature in 'DirectQuery' mode.

When I try to connect a stored procedure in SELECT from OPENROWSET from 'DirectQuery,' mode, I get the following error message. Thanks.


Helpful resources

Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors