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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
krish087
New Member

executing stored procedure

I am trying to execute Stored procedure and fetch results, I am getting error can any one help?

4 REPLIES 4
arelf27
Helper II
Helper II

I'm trying to execute a simple stored procedure and getting error: "the EXECUTE permission was denied on object 'stored proc name', database 'database name', schema 'dbo'."

 

Stored proc is just this:

USE [DB name]
GO

CREATE PROCEDURE [dbo].P_x AS

SELECT 'x' as name
go

 

I am able to use views from this same db no problem and have created a number of reports, dashboards, etc. however for the life of me can't figure out how to use a stored proc instead of a view..

 

To connect inside PowerBI I use the following syntax:

SELECT *
FROM OPENQUERY ([server_x],
'EXEC db_x.dbo.P_x');

@arelf27 What is the reasoning for using the OPENQUERY?

You are all ready setting the connection to the database, if you just use "EXECUTE dbo.P_x" it should run without any issues.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

I believe I need to do openquery as I'm using DirectQuery not Import option. From what I read openquery should work for either.. I did try just execute dbo.p_x and it worked to where I could see the resultset of my stored proc and even the sequel statement appeared fine and said there are no syntax errors, however strangely enough, when I pressed close & apply it says there's a syntax error....so had to go back to query window and delete the query.. I think it's because of the DirectQuery.. I mean otherwise what would be the mechanism of re-running the stored proc for updated resultset? (in other project where I'm using Import I am able to execute the stored proc per the method you mention and it works fine...I just really want to stick to DirectQuery for this project)

Greg_Deckler
Community Champion
Community Champion

What is the error that you are getting? Is it something along the lines of "not authorized for execution"?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.