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

Sql commands not allowed in Direct query mode?

Is it only the SELECT sql command which is allowed in Direct query mode?

 

I get error message when I try to update my PowerBI Desktop project with a L language Direct query mode script that run a sql expression that start with the USE <db name> command. (There was no error message when saving the M script in the Advanced editor).

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

yes and no.  You can run whatever SQL injection you want, little Bobby Tables. HOWEVER !!! Chris Webb's BI Blog: Why Is Power BI Running My SQL Query Twice? (crossjoin.co.uk)  In short - don't get any ideas. It's not worth it.

View solution in original post

2 REPLIES 2
FrankKrogh
Helper I
Helper I

I got a very excellent explanation and solution from Chris Webb in another post.

Direct query syntax returns data in PowerQuery perfectly but shows error when update PowerBI project 

He noted that "Basically, if you can't use your SQL query as a subquery then you can't use it as a source in DirectQuery mode."

 

To my great relief all my trouble dissapeared when he explaned the workaround to apply table valued function as a source in DirectQuery mode TSQL Table-Valued Functions And Dynamic M Parameters In Power BI DirectQuery 

lbendlin
Super User
Super User

yes and no.  You can run whatever SQL injection you want, little Bobby Tables. HOWEVER !!! Chris Webb's BI Blog: Why Is Power BI Running My SQL Query Twice? (crossjoin.co.uk)  In short - don't get any ideas. It's not worth it.

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