Skip to main content

Scalar Functions — Type Conversion

Type conversion functions cast values between KQL's scalar types. The basic numeric and string casts work across all dialects. More advanced conversions like toguid() and gettype() are only available in ClickHouse and PostgreSQL. typeof() has no SQL equivalent and is not supported in any dialect.

Legend: ✅ Supported · ⚠️ Approximated · ❌ Not Supported · 🔄 Rewritten

FunctionSQLiteMySQLClickHousePostgreSQLNotes
tostring()CAST(... AS TEXT)
todouble() / toreal()CAST(... AS REAL)
toint() / tolong()CAST(... AS INTEGER)
tobool()CAST(... AS INTEGER)
todecimal()CAST(... AS NUMERIC)
todynamic() / toobject()
toguid()
gettype()ClickHouse: toTypeName; Postgres: pg_typeof
typeof()Compile-time hint; no SQL equivalent