Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
We created stored procedures in Azure SQL Database and trying to use them power BI report with Direct Query mode. But getting the error like "Microsoft SQL: Incorrect syntax near the keyword 'EXEC'. Incorrect syntax near ')'.
Another question is how to set the connection string as global so that I can use the same connection string in every report?
Please help me with the solution
I found a way to make it work with an On-Prem SQL Server 2016 database and Power BI Gateway: you need to copy the syntax that SQL Server generates when running a Stored Procedure.
In Power BI use the Advanced Editor to change your query to look something like this:
let
Source = Sql.Database("MySqlServerName", "MyDbName", [Query="DECLARE#(tab)@return_value int = 0; #(lf)#(lf)EXEC#(tab)@return_value = [MySchema].[MySP]; #(lf)#(lf)SELECT#(tab)'Return Value' = @return_value; "])
in
Source
Hope this helps in your Azure SQL DB,
I found a way to make it work with an On-Prem SQL Server 2016 database and Power BI Gateway: you need to copy the syntax that SQL Server generates when running a Stored Procedure.
In Power BI use the Advanced Editor to change your query to look something like this:
let
Source = Sql.Database("MyServerName", "MyDbName", [Query="DECLARE#(tab)@return_value int = 0; #(lf)#(lf)EXEC#(tab)@return_value = [MySchema].[MyStoredProcedure]; #(lf)#(lf)SELECT#(tab)'Return Value' = @return_value; "])
in
Source
Hope this helps in your Azure SQL DB.......................... -RM
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 40 | |
| 35 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 71 | |
| 70 | |
| 38 | |
| 35 | |
| 23 |