Επεξεργασία

Κοινή χρήση μέσω


Scalar data types

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Every data value, like the value of an expression or a function parameter, has a data type which is either a scalar data type or a user-defined record. A scalar data type is one of the built-in predefined types in Supported data types. A user-defined record is an ordered sequence of name and scalar-data-type pairs, like the data type of a row in a table.

As in most languages, the data type determines what calculations and manipulations can be run against a value. For example, if you have a value that is of type string, you won't be able to perform arithmetic calculations against it.

Note

While user-defined records are supported in Kusto, user-defined data types aren't.

Supported data types

In Kusto Query Language, most of the data types follow standard conventions and have names you've probably seen before. The following table shows the full list:

Type Description
bool (boolean) true (1) or false (0).
datetime (date) An instant in time, typically expressed as a date and time of day.
decimal A 128-bit wide, decimal number.
dynamic An array, a property bag, or a value of any of the other scalar data types.
guid (uuid, uniqueid) A 128-bit globally unique value.
int A signed, 32-bit wide, integer.
long A signed, 64-bit wide, integer.
real (double) A 64-bit wide, double-precision, floating-point number.
string A sequence of zero or more Unicode characters.
timespan (time) A time interval.

Tip

To check the data type of a value, use the gettype() function.

While most of the data types are standard, you might be less familiar with types like dynamic or timespan, and guid.

  • Dynamic has a structure similar to JSON, but with one key difference: It can store Kusto Query Language-specific data types that traditional JSON can't, such as a nested dynamic value, or timespan.

  • Timespan is a data type that refers to a measure of time such as hours, days, or seconds. Don't confuse timespan with datetime, which evaluates to an actual date and time, not a measure of time. The following table shows a list of timespan suffixes.

  • GUID is a datatype representing a 128-bit, globally unique identifier, which follows the standard format of [8]-[4]-[4]-[4]-[12], where each [number] represents the number of characters and each character can range from 0-9 or a-f.

Null values

All nonstring data types can be null. When a value is null, it indicates an absence or mismatch of data. For example, if you try to input the string abc into an integer column, it results in the null value. To check if an expression is null, use the isnull() function.

For more information, see Null values.