to_csv
function
Applies to: Databricks SQL Databricks Runtime
Returns a CSV string with the specified struct value.
Syntax
to_csv(expr [, options] )
Arguments
expr
: A STRUCT expression.options
: An optional MAP literal expression with keys and values being STRING.
Returns
A STRING.
See from_csv function for details on possible options
.
Examples
> SELECT to_csv(named_struct('a', 1, 'b', 2));
1,2
> SELECT to_csv(named_struct('time', to_timestamp('2015-08-26', 'yyyy-MM-dd')), map('timestampFormat', 'dd/MM/yyyy'));
26/08/2015
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for