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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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