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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Ruchi23
Frequent Visitor

T-SQL executing directly in Eventhouse KQL Queryset without comment (--) prefix

Hey everyone,

I was just exploring Eventhouse and noticed something weird. The docs say you need to add "--" on its own line before T-SQL queries in KQL querysets, but I'm running T-SQL commands just fine without it.

I never added the "--" prefix and all T-SQL queries executed normally.

Is this a recent change? The documentation still mentions needing the comment prefix to switch to T-SQL mode, but it seems like the query editor is just auto-detecting it now?
Reference: https://learn.microsoft.com/en-us/kusto/query/t-sql?view=microsoft-fabric

1 ACCEPTED SOLUTION
v-pnaroju-msft
Community Support
Community Support

Thank you, @ svelde for your response.

Hi Ruchi23,

We appreciate your inquiry through the Microsoft Fabric Community Forum and thank you for validating the behavior across both Fabric Eventhouse and Azure Data Explorer.

Based on my understanding, the observed behavior may be due to the query editor's language auto-detection. Modern Fabric and ADX web query editors may automatically recognize T‑SQL syntax and route the query to the T‑SQL engine even without the -- prefix. This could be an editor convenience feature, and does not represent a change to the underlying Kusto or T‑SQL language requirements.
Official Microsoft documentation continues to recommend starting T‑SQL queries with a standalone -- because it explicitly forces T‑SQL mode and avoids ambiguity. It also ensures consistent behaviour across automation, APIs, scripts and non‑UI tools. Moreover, certain advanced or mixed syntax scenarios still rely on explicit mode selection.

We hope the information above helps to resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.

View solution in original post

7 REPLIES 7
v-pnaroju-msft
Community Support
Community Support

Hi Ruchi23,

Thank you for the update. Please continue to use the Microsoft Fabric community for any further queries.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Thank you, @ svelde for your response.

Hi Ruchi23,

We appreciate your inquiry through the Microsoft Fabric Community Forum and thank you for validating the behavior across both Fabric Eventhouse and Azure Data Explorer.

Based on my understanding, the observed behavior may be due to the query editor's language auto-detection. Modern Fabric and ADX web query editors may automatically recognize T‑SQL syntax and route the query to the T‑SQL engine even without the -- prefix. This could be an editor convenience feature, and does not represent a change to the underlying Kusto or T‑SQL language requirements.
Official Microsoft documentation continues to recommend starting T‑SQL queries with a standalone -- because it explicitly forces T‑SQL mode and avoids ambiguity. It also ensures consistent behaviour across automation, APIs, scripts and non‑UI tools. Moreover, certain advanced or mixed syntax scenarios still rely on explicit mode selection.

We hope the information above helps to resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.

Thanks for the detailed explanation.
That makes a lot of sense. So basically the web editor is doing us a favor by auto-detecting, but if I'm writing scripts or using APIs I should still use the "--"prefix to be safe.

Good to know it's more of a best practice thing rather than the docs being wrong. I'll stick with adding the prefix going forward. 

Appreciate the clarification!

Thanks for the detailed explanation.
That makes a lot of sense. So basically the web editor is doing us a favor by auto-detecting, but if I'm writing scripts or using APIs I should still use the "--"prefix to be safe.

Good to know it's more of a best practice thing rather than the docs being wrong. I'll stick with adding the prefix going forward. 

Appreciate the clarification!

svelde
Most Valuable Professional
Most Valuable Professional

Hello @Ruchi23 

Microsoft documentation is open sources and they accept pull requests.

If you have GitHub account, you can change the page yourself here and provide the change as pull request.

If the change is accepted by the official author, this change will make you an official contributor to Microsoft documentation.

 

-------------------------
Ask me about IoT&RTI
svelde
Most Valuable Professional
Most Valuable Professional

Hello @Ruchi23,

Welcome to this community forum.

Good catch, I also experience that my SQL queries work will without the '--' on a separate in from of the query, when I use the Fabric portal KQL Queryset editor.

That said, it can be that other editors for eg. Azure Data Explorer or Microsoft Sentinel still need that extra line. I'm not able to test this.

 

--

If this answer helps, please upvote it. Thanks.

-------------------------
Ask me about IoT&RTI

Thanks for confirming!
I actually tested this on Azure Data Explorer as well and got the same result, T-SQL queries work there too without the "--" prefix.

Looks like the query editors are just smart enough to figure it out now. I wonder if the docs are just outdated at this point or if there's some specific case where you still need it that we just haven't run into yet.

Helpful resources

Announcements
June Fabric Update Carousel

Fabric Monthly Update - June 2026

Check out the June 2026 Fabric update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Top Solution Authors
Top Kudoed Authors