Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
TahmidBari
Helper I
Helper I

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 *
from
openrowset('SQLOLEDB','SERVER=SERVERNAME;Trusted_Connection=yes;',' set fmtonly off;

exec DATABASE..SPNAME

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

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

https://learn.microsoft.com/en-us/sql/t-sql/functions/openrowset-transact-sql?view=sql-server-2017

2 REPLIES 2
TahmidBari
Helper I
Helper I

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.

TahmidBari_0-1672959881084.png

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.