Run T-SQL in a KQL database only by prefixing the query with a -- comment line

DP-700 By islever Editorial Last updated

Short answer

B No. T-SQL in a KQL database must begin with a '--' comment line; without it the query is treated as KQL and does not run as intended.

Question

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution. After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen. You have a Fabric eventstream that loads data into a table named Bike_Location in a KQL database. The table contains the following columns: BikepointID - Street - Neighbourhood - No_Bikes - No_Empty_Docks - Timestamp - You need to apply transformation and filter logic to prepare the data for consumption. The solution must return data for a neighbourhood named Sands End when No_Bikes is at least 15. The results must be ordered by No_Bikes in ascending order. Solution: You use the following code segment: Does this meet the goal? - Exhibit: Run T-SQL in a KQL database only by prefixing the query with a --
  1. Yes
  2. No Correct Answer

Key Takeaways

A T-SQL query inside a KQL database is only executed as T-SQL when prefixed with a '--' line; omitting it causes the query to be parsed as KQL and not meet the goal.

In a Microsoft Fabric KQL database, a query is interpreted as KQL by default. To run it as T-SQL you must begin the query with an empty T-SQL comment line (--), which tells the editor to interpret the following statements as T-SQL; without that prefix the code is treated as KQL and fails.

Common mistake: Writing valid T-SQL but forgetting the leading '--' comment line, so the KQL database interprets it as KQL syntax and the query does not run as intended.

Expert Analysis

Why the Answer Is Correct

The scenario requires the transformation to run as T-SQL against the KQL database. Fabric documentation states that to run a T-SQL query you must begin with an empty T-SQL comment line (--), which tells the query editor to interpret the following query as T-SQL rather than KQL. The proposed solution (presented as an image) lacked that prefix, so the code would be parsed as KQL and would not execute as T-SQL, failing to meet the goal. Hence the answer is No.

Why the Other Options Are Wrong

Option A (Yes) would only be correct if the solution started with the '--' T-SQL prefix; without it the KQL database does not run the statement as T-SQL.

Community Comment Notes

Community voting favors No (52 vs 48). Comments (JensQ, fassil, Zoran_S) explicitly cite the requirement to preface T-SQL with a '--' line in a KQL database. As with the sibling question, the solution code was provided as an image in the source item, so the determination relies on the documented '--' prefix rule combined with community consensus.

Official Reference

https://learn.microsoft.com/en-us/kusto/query/t-sql?view=microsoft-fabric

This link opens the official vendor documentation in a new tab.

Community Votes

B
52%
A
48%

52% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 8 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 8

  1. Mourya959595 👍 11 Answered A
    SQL By default shows ASC order
  2. fassil 👍 3 Answered B
    To run a T-SQL query, you need to begin the query with an empty T-SQL comment line (--). This tells the query editor to interpret the following query as T-SQL and not KQL
  3. Bharat 👍 3 Answered B
    the answer is correct since there is no mention of 'Enable SQL Endpoint'. If it is enabled then the correct answer would have been A
  4. JensQ 👍 3 Answered B
    You need to use "--" to tell the KQL DB to read code as SQL. Otherwise it tries to read it as KQL
  5. Sher_Lock_Alexa 👍 3 Answered A
    sql ASC is the default sort order
Show 3 more comments
  1. Zoran_S 👍 2 Answered B
    "Remember to preface T-SQL queries with a T-SQL comment line, --, to tell the query editor to interpret the following query as T-SQL and not KQL." While the code syntax is correct it is missing the '--' in the beginning to tell KQL to run it as T-SQL. Therefor it should be incorrect
  2. JensQ 👍 2 Answered B
    "To run a T-SQL query, begin the query with an empty T-SQL comment line: --. The -- syntax tells the query editor to interpret the following query as T-SQL and not KQL." https://learn.microsoft.com/en-us/kusto/query/t-sql?view=microsoft-fabric#query-with-t-sql
  3. kostadiv 👍 2 Answered B
    missing "--" in the beginning

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

← Back to DP-700 Study Guide