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

M language script that runs a text search in stored procedures in SQL server sys.databases

I have tried to design a M language script that runs a text search in stored procedures in SQL server sys.databases. When I view the script code in Advanced edit mode there is a note below the script that conclude with "No script errors are registrated".

 

Unfortunately I cannot identify what needs to be corrected in the script when reading the error message "Incorrect syntax near ''. " returned in PowerQuery .

 

It seems to me that the debug information in Power Query regarding execution of first step unfortunate is not present in current version of PowerBI Desktop.

 

First step in execution.PNG

 

M language script.PNG

 

Source SQL.PNG

2 ACCEPTED SOLUTIONS
foodd
Super User
Super User

@FrankKrogh , would this not be a case to create a view upstream, and connect to the view?

View solution in original post

Yes, it seems to me to be the only solution as long as only the SELECT command is accepted in Direct query mode. 

View solution in original post

5 REPLIES 5
ImkeF
Super User
Super User

Hi @FrankKrogh ,
I don't have experience with DirectQuery mode, so cannot help you with it.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

foodd
Super User
Super User

@FrankKrogh , would this not be a case to create a view upstream, and connect to the view?

Yes, it seems to me to be the only solution as long as only the SELECT command is accepted in Direct query mode. 

ImkeF
Super User
Super User

Hi @FrankKrogh ,
what I see in the first picture you've posted looks like a correct result to me: It will appear when your parameter/query "paramDBname" is empty.
This is not an error on PQ side.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

It seems to me that PowerQuery does not accept the USE <db name> sql command in the Direct query mode. I tried to hardcode the db name but still received error message when I updated the project. 

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.

Top Solution Authors
Top Kudoed Authors