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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors