cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
derektd
Frequent Visitor

Executing Stored PRocedure with Direct Query Mode

Has anyone been able to get around this, yet.

 

I have tried: 

let SQLStoredProc = () => SQL.database("Server","Database",[Query="EXEC dbo.RPT_Report"])
in SQLStoredProc

 

Result - Details: "Microsoft SQL: Incorrect syntax near '='."

 

Tried:

let SQLStoredProc = () => SQL.database("Server","Database",[Query="EXEC [dbo].[RPT_FlashReport]"])
in SQLStoredProc

 

Result - Details: "Microsoft SQL: Incorrect syntax near '='. Unclosed quotation mark after the character string '])
in SQLStoredProc'."

 

Tried:

DECLARE @sqlCommand varchar(1000)

SET @sqlCommand = 'dbo.Testproc'
EXEC (@sqlCommand)

 

This one gets past the initial load and will bring me into query editor, but when I try to apply and close the result below occurs.

Result - Microsoft SQL: Incorrect syntax near the keyword 'DECLARE'. Incorrect syntax near ')'.

2 REPLIES 2
v-cherch-msft
Microsoft
Microsoft

Hi @derektd 

Please check if the workarounds in below posts could help you.

https://community.powerbi.com/t5/Integrations-with-Files-and/parameters-to-SP-or-Sql-query/m-p/58337...

https://community.powerbi.com/t5/Desktop/Why-is-DECLARE-not-supported-Error/td-p/40983/page/2

Regards,

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

@v-cherch-msft No Luck: I tried...

let
SQLSource = () =>
let
Source = Sql.Database("hrc-testssql", "test_ods", [Query="Exec dbo.RPT_Report"])
in
Source
in
SQLSource

 

And I keep getting the message "Incorrect syntax near "=".

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors