共用方式為


Set statement

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

The set statement is used to set a request property for the duration of the query.

要求屬性會控制查詢的執行方式,並傳回結果。 它們可以是布爾值旗標,預設 false 為 ,或具有整數值。 查詢可能包含零、一或多個 set 語句。 Set 語句只會影響以程式順序追蹤這些語句的表格式表達式語句。 任何兩個語句都必須以分號分隔。

要求屬性不是正式 Kusto 查詢語言 的一部分,而且可能會在不被視為重大語言變更的情況下修改。

Note

Syntax

set OptionName [=OptionValue]

Learn more about syntax conventions.

Parameters

Name 類型 Required Description
OptionName string ✔️ 要求屬性的名稱。
OptionValue ✔️ 要求屬性的值。

Example

此查詢用來 query_take_max_records 限制從資料表擷取 StormEvents 的記錄數目。 (這有點等同於使用 | take 100 運算子。

The examples in this article use publicly available tables in the help cluster, such as the StormEvents table in the Samples database.

The examples in this article use publicly available tables, such as the Weather table in the Weather analytics sample gallery. 您可能需要修改範例查詢中的資料表名稱,以符合工作區中的資料表。

set query_take_max_records=100;
StormEvents

Output

下表顯示前幾個結果。

StartTime EndTime EpisodeId EventId State EventType
2007-01-15T12:30:00Z 2007-01-15T16:00:00Z 1636 7821 OHIO Flood
2007-08-03T01:50:00Z 2007-08-03T01:50:00Z 10085 56083 NEW YORK Thunderstorm Wind
2007-08-03T15:33:00Z 2007-08-03T15:33:00Z 10086 56084 NEW YORK Hail
2007-08-03T15:40:00Z 2007-08-03T15:40:00Z 10086 56085 NEW YORK Hail
2007-08-03T23:15:00Z 2007-08-05T04:30:00Z 6569 38232 NEBRASKA Flood
2007-08-06T18:19:00Z 2007-08-06T18:19:00Z 6719 39781 IOWA Thunderstorm Wind
... ... ... ... ... ...