cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thedavegray
New Member

Executing SQL procs

Hello, 

 

Is it not possible to EXEC SQL Server (SQL 2014) stored procs from PowerBI?  I've been reading various posts on different forums and people are saying that I need to use OPENQUERY for this, is this this correct?   I basically have 7 stored procs that all return tables that I want to display independanly on a a single dashboard.   I want the stored procs to be called every time the dashboard refreshes so direct query seems to make sense, rather than import. 

 

What I mean by "independanly" is that they should not have dependancies on each other, so slight follow up question, how do I stop dependancies, would it just be some form on panel? 

 

Thanks

 

 

 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Microsoft
Microsoft

@thedavegray,

I am not quite clear about your requirement that call stored procedure when the dashboard refreshes. Could you please elaborate your expected result?

In Power BI Desktop, you can call stored procedure by passing different parameter values as described by Eric in this similar thread. Or you can import data from Stored procedure using OPENQUERY as follows.

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yuezhe-msft
Microsoft
Microsoft

@thedavegray,

I am not quite clear about your requirement that call stored procedure when the dashboard refreshes. Could you please elaborate your expected result?

In Power BI Desktop, you can call stored procedure by passing different parameter values as described by Eric in this similar thread. Or you can import data from Stored procedure using OPENQUERY as follows.

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ok so this does not appear to work.  I have enabled "exec sp_server_option 'server', 'data access', 'true'

 

The stored procedure I want to connect to has multiple parameters where only the first is mandatory.  The error I'm getting relates to the stored procedure using #temp tables.  Is this really true, you cannot call stored procedures that make use of temp tables? 

 

Image 008.png

"Or you can import data from Stored procedure using OPENQUERY as follows." 

 

Does that mean that it's a one-time import?  I want the data loaded on schedule. 

 

Thanks

 

Hello, 

Sorry I don't seem to be getting notification so only just realised that you had posted.   Thanks, you example will 

work for my requirments. 

 

Regards

 

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors