Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Converts a string to a guid scalar.
Note
When possible, use guid literals instead.
Syntax
toguid(value)
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | scalar | ✔️ | The value to convert to guid. |
Returns
The conversion process takes the first 32 characters of the input, ignoring properly located hyphens, validates that the characters are between 0-9 or a-f, and then converts the string into a guid scalar. The rest of the string is ignored.
If the conversion is successful, the result is a guid scalar. Otherwise, the result is null.
Example
The following example converts strings in a datatable that fit the conversion structure requirements, to guid.
datatable(str: string)
[
"0123456789abcdef0123456789abcdef",
"0123456789ab-cdef-0123-456789abcdef",
"a string that is not a guid"
]
| extend guid = toguid(str)
Output
| str | guid |
|---|---|
| 0123456789abcdef0123456789abcdef | 01234567-89ab-cdef-0123-456789abcdef |
| 0123456789ab-cdef-0123-456789abcdef | 01234567-89ab-cdef-0123-456789abcdef |
| a string that isn't a guid |