<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using a UDF in %sql? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/using-a-udf-in-sql/m-p/34217#M24987</link>
    <description>&lt;P&gt;Got it working (but going to post a new question momentarily): I needed to use timestamp(date '3000-01-01) instead of to_timestamp&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2022 15:43:02 GMT</pubDate>
    <dc:creator>BradSheridan</dc:creator>
    <dc:date>2022-09-13T15:43:02Z</dc:date>
    <item>
      <title>Using a UDF in %sql?</title>
      <link>https://community.databricks.com/t5/data-engineering/using-a-udf-in-sql/m-p/34216#M24986</link>
      <description>&lt;P&gt;Afternoon everyone!  I logged in hoping to see some suggestions but think maybe I need to reword the question a little &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I create a UDF that converts '30000101' to timestamp and then use it in a query like below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sql&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;field1,&lt;/P&gt;&lt;P&gt;field2,&lt;/P&gt;&lt;P&gt;nvl(somedatefield, myUDF)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, if the somedatefield in the source is null, always return 30000101 formatted as Timestamp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 13:38:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-a-udf-in-sql/m-p/34216#M24986</guid>
      <dc:creator>BradSheridan</dc:creator>
      <dc:date>2022-08-19T13:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using a UDF in %sql?</title>
      <link>https://community.databricks.com/t5/data-engineering/using-a-udf-in-sql/m-p/34217#M24987</link>
      <description>&lt;P&gt;Got it working (but going to post a new question momentarily): I needed to use timestamp(date '3000-01-01) instead of to_timestamp&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 15:43:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/using-a-udf-in-sql/m-p/34217#M24987</guid>
      <dc:creator>BradSheridan</dc:creator>
      <dc:date>2022-09-13T15:43:02Z</dc:date>
    </item>
  </channel>
</rss>

