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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

DIRECT QUERY SYNTAX ERROR WHEN SAME QUERY WORKS FOR IMPORT

WHEN RUNNING A STORED PROCEDURE FROM THE DATABASE THE DATA IS SHOWN AND IF IMPORTED WORKS. IF DIRECT QUERY THE DATA IS SHOW BUT WHEN YOU APPLY IS GIVES YOU A SYNTAX ERROR EVENTHOUGH THE ADVANCED QUERY EDITOR SAYS NO SYNTAX ERRORS. PLEASE SEE BELOW

 

 ADV EDITOR.JPGERROR.JPG

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

It seems you need to get the data by consuming SQL Server Stored Procedure, also SQL Server Stored Procedures has parameters which you need to pass dynamically.

 

There is a solution about execute Stored Procedure using Managed Parameters in Power BI.

But This feature will work only for Import Mode.

 

As for direct query mode, 

You may refer to the post below that makes use of OPENROWSET.

https://community.powerbi.com/t5/Desktop/Calling-SQL-stored-procedure-with-Direct-Query/td-p/224831

 

Best regards

Maggie

 

Community Support Team _ Maggie Li
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

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

It seems you need to get the data by consuming SQL Server Stored Procedure, also SQL Server Stored Procedures has parameters which you need to pass dynamically.

 

There is a solution about execute Stored Procedure using Managed Parameters in Power BI.

But This feature will work only for Import Mode.

 

As for direct query mode, 

You may refer to the post below that makes use of OPENROWSET.

https://community.powerbi.com/t5/Desktop/Calling-SQL-stored-procedure-with-Direct-Query/td-p/224831

 

Best regards

Maggie

 

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

v-juanli-msft
Community Support
Community Support

Hi @Anonymous

which does "UPDATECOME1_2" refer to?

If it is a column name, you need change as below:

Query="select [1] from Order1"

select columnname from tablename

 

If error insists, could you share the screenshot with me for better analysis?

7.png

 

 

Best Regards

Maggie

Anonymous
Not applicable

Capture1.JPGCapture2.JPGCapture3.JPGCapture4.JPG

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

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