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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
BenBlackswan
Helper V
Helper V

Why I can not use the GO Statement in Power Query?

hello all, 

 

My SQL script with GO statements in them works fine is SSMS, it is able to query the database.

 

But when I copy the script in Power Query's SQL Statement to make connection with the database, it gives me the following error

Nietzsche_0-1739225476269.png

 

But when I take the GO statements out, the PQ is able to connect with the database.

 

Am I able to fix this error or is GO statement not allowed in PQ?

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Not allowed. You can only run queries*, not transactions. 

 

Use  a Stored Procedure or a view to hide the "ugly"  code from Power Query.

 

* yes, I said queries. While you are supposed to only ever run a single SELECT query, it is unfortunately technically possible to chain all sorts of crazy queries as long as the last one is a SELECT.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Not allowed. You can only run queries*, not transactions. 

 

Use  a Stored Procedure or a view to hide the "ugly"  code from Power Query.

 

* yes, I said queries. While you are supposed to only ever run a single SELECT query, it is unfortunately technically possible to chain all sorts of crazy queries as long as the last one is a SELECT.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors