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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
sajal161292
Helper V
Helper V

how to execute a stored procedure in Power BI desktop file

Need help in creating a button in power bi that should perform the action of truncating a table in Power BI desktop file.

I am using the DirectQuery mode and trying to execute a stored procedure for truncating the data but with no success in it till now.

 

Please help me with your inputs for it.

2 REPLIES 2
Gabrielfranco
Frequent Visitor

Hi @sajal161292 

 

its possible to do that using the OPENROWSET function as the example bellow

 

SELECT * FROM
OPENROWSET('SQLOLEDB','SERVER=SERVERNAME;Trusted_Connection=yes;',
'set fmtonly off;exec DW..P750106100 @NR_VERSION=1, @NR_INSTI=NULL,@NR_YEAR=NULL')

The only problem is that you need to specify the parameters on the call. I didn't find another way beyond that

 

obs: dont forget to enable it in SQLServer

USE MASTER
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO       
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

 

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @sajal161292,

 

You may have a reference to the similar post below that makes use of OPENROWSET.

 

Calling SQL stored procedure with Direct Query

 

Best  Regards,

Cherry

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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