Get started
Load & manage data
Work with data
Administration
Reference & resources
CLUSTER BY
mask
ROW FILTER
Updated Dec 23, 2024
Send us feedback
to_xml
Applies to: Databricks SQL Databricks Runtime
Returns an XML string with the struct specified in expr.
expr
to_xml(expr [, options] )
expr: A STRUCT expression.
options: An optional MAP literal expression with keys and values being STRING.
options
A STRING.
See from_xml function for details on possible options.
> SELECT to_xml(named_struct('a', 1, 'b', 2)); <ROW><a>1</a><b>2</b></ROW> > SELECT to_xml(named_struct('time', to_timestamp('2015-08-26', 'yyyy-MM-dd')), map('timestampFormat', 'dd/MM/yyyy')); <ROW><time>26/08/2015</time></ROW>
: operator
from_xml function
schema_of_xml function
from_json function
schema_of_json function
to_json function