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

Ingest and transform streaming data
Answer Correct 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.

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? - image

  1. Yes
  2. No Correct Answer

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.

Community Insight

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.

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.

Community Discussion (8 comments)

Mourya959595 👍 11 Selected: A
SQL By default shows ASC order
JensQ 👍 3 Selected: B
You need to use "--" to tell the KQL DB to read code as SQL. Otherwise it tries to read it as KQL
Sher_Lock_Alexa 👍 3 Selected: A
sql ASC is the default sort order
fassil 👍 3 Selected: 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
JensQ 👍 2 Selected: 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
kostadiv 👍 2 Selected: B
missing "--" in the beginning
Zoran_S 👍 2 Selected: 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
Bharat 👍 3 Selected: 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

Comments & Corrections

No comments 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.

Submitted for moderation before publishing. Keep it helpful and respectful.

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

Related Analysis

← Back to DP-700 Study Guide