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
arun_1047
Helper I
Helper I

Gettin Error while loading the SP data using DirectQuery

Hello,

 I was trying to use the Stored procedure using Direct Query  in Power BI on Prem OCT Version

I am getting the below error message while loading the data into Power BI desktop itself

"Incorrect  Syntax near the  Keyword EXEC. Incorrect Syntax  near )".

 

Steps:

Connected  source  using GetData-> SQL Server-> DirectQuery ->Advance Option-> EXEC SPName

 

Power BI Desktop Version: 2.51.4885.1423 64-bit (October, 2017)

2 REPLIES 2
Anonymous
Not applicable

http://community.powerbi.com/t5/Desktop/Use-SQL-Store-Procedure-in-Power-BI/td-p/20269

You must be using DirectQuery mode, in which you cannot connect to data with stored procedures. Try again using Import mode or just use a SELECT statement directly.

Anonymous
Not applicable

Hi @arun_1047

 

I have played a bit with your scenario. Using just 'exec sp_proc' does not work indeed, the statement sent to the SQL Server is not syntactically correct:

 

select * from (exec sp_test) SourceQuery where 1 = 2

 

You can use OPENQUERY as mentioned here, however you'll need your SQL Server setup for data access.

 

Regards,

Maria

 

sproc_directq.png

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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

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.