← Back
Databricks SQL 2025.40 arrives with SQL scripting GA, advanced sketch functions
· releasefeatureapi · docs.databricks.com ↗

SQL Scripting Now Generally Available

SQL scripting is now generally available in Databricks SQL, enabling developers to write procedural logic directly in SQL. This includes conditional statements, loops, local variables, and exception handling—bringing capabilities typically found in stored procedures to the Databricks SQL environment.

Expanded Parameter and Identifier Support

Parameter markers have been significantly expanded:

  • Named parameters (:param) and unnamed parameters (?) now work anywhere a literal value is allowed
  • Supported contexts include DDL statements (CREATE VIEW v AS SELECT ? AS c1), column type definitions (DECIMAL(:p, :s)), and comments
  • This parameterization prevents SQL injection attacks without requiring string concatenation

The IDENTIFIER clause now works in nearly all contexts where identifiers are permitted, allowing you to parameterize column aliases (AS IDENTIFIER(:name)) and column definitions (IDENTIFIER(:pk) BIGINT NOT NULL).

String Literal Coalescing

Sequential string literals now automatically coalesce into a single string in any context where string literals are allowed. For example, 'Hello' ' World' becomes 'Hello World', including in comments like COMMENT 'This' ' is a ' 'comment'.

New Approximate Computation Functions

Two new libraries of sketch-based functions have been added for efficient approximate computations:

Theta Sketch Functions (for approximate distinct counts and set operations):

  • theta_sketch_agg, theta_union_agg, theta_intersection_agg aggregate functions
  • theta_sketch_estimate, theta_union, theta_difference, theta_intersection functions

KLL Sketch Functions (for approximate quantiles):

  • Aggregate and query functions for bigint, double, and float types
  • Includes kll_sketch_agg_*, kll_sketch_get_quantile_*, kll_sketch_merge_*, plus utility functions for rank and cardinality estimation

Additionally, a new BITMAP_AND_AGG function complements the existing bitmap function library.

Availability

Version 2025.40 became available in Preview on February 11, 2026, and is now rolling out to the Current channel as of February 23, 2026.