Using a UDF in %sql?

BradSheridan
Databricks Partner

Afternoon everyone! I logged in hoping to see some suggestions but think maybe I need to reword the question a little 🙂

How can I create a UDF that converts '30000101' to timestamp and then use it in a query like below?

%sql

select

field1,

field2,

nvl(somedatefield, myUDF)

In other words, if the somedatefield in the source is null, always return 30000101 formatted as Timestamp

thanks!!