Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Converts a string to a guid
scalar.
Note
When possible, use guid literals instead.
toguid(
value)
Learn more about syntax conventions.
Name | Type | Required | Description |
---|---|---|---|
value | scalar | ✔️ | The value to convert to guid. |
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
.
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 |