<?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 Parse Syntax error ,can anyone guide me what is going wrong here in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24128#M16751</link>
    <description>&lt;P&gt;&lt;B&gt;Select case WHEN {{ Month }} = 0 then add_months(current_date(),-13 ) else&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;WHEN {{ Month }}&amp;gt; month(add_months(current_date(),-1)) then add_months(to_date(concat(year(current_date())-1,'-',{{Month}},'-',1)),-13)&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else add_months(to_date(concat(year(current_date()),'-',{{Month}},'-',1)),-13) end dt&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here Month is a parameter with dropdownlist having values from 0-12. However, while executing the sql, getting parse_syntax_error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is pasted below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near '0'line 1, pos 17&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;== SQL ==&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;Select case WHEN 0 = 0 then add_months(current_date(),-13 ) else&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;-----------------^^^&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;WHEN 0&amp;gt; month(add_months(current_date(),-1)) then add_months(to_date(concat(year(current_date())-1,'-',0,'-',1)),-13)&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else add_months(to_date(concat(year(current_date()),'-',0,'-',1)),-13) end dt LIMIT 1000&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;&lt;/I&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2022 17:57:56 GMT</pubDate>
    <dc:creator>Sajid1</dc:creator>
    <dc:date>2022-11-02T17:57:56Z</dc:date>
    <item>
      <title>Parse Syntax error ,can anyone guide me what is going wrong here</title>
      <link>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24128#M16751</link>
      <description>&lt;P&gt;&lt;B&gt;Select case WHEN {{ Month }} = 0 then add_months(current_date(),-13 ) else&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;WHEN {{ Month }}&amp;gt; month(add_months(current_date(),-1)) then add_months(to_date(concat(year(current_date())-1,'-',{{Month}},'-',1)),-13)&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else add_months(to_date(concat(year(current_date()),'-',{{Month}},'-',1)),-13) end dt&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here Month is a parameter with dropdownlist having values from 0-12. However, while executing the sql, getting parse_syntax_error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is pasted below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near '0'line 1, pos 17&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;== SQL ==&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;Select case WHEN 0 = 0 then add_months(current_date(),-13 ) else&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;-----------------^^^&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;WHEN 0&amp;gt; month(add_months(current_date(),-1)) then add_months(to_date(concat(year(current_date())-1,'-',0,'-',1)),-13)&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else add_months(to_date(concat(year(current_date()),'-',0,'-',1)),-13) end dt LIMIT 1000&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&amp;nbsp;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 17:57:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24128#M16751</guid>
      <dc:creator>Sajid1</dc:creator>
      <dc:date>2022-11-02T17:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Parse Syntax error ,can anyone guide me what is going wrong here</title>
      <link>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24130#M16753</link>
      <description>&lt;P&gt;My bad, I had missed with the syntax and rewrote the first condition in a alternate manner and it fixed it. Thanks for your time to go through the post&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The update code is for your reference&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select case {{ Month }} WHEN 0 then add_months(current_date(),-13 )&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHEN {{ Month }} &amp;gt; month(add_months(current_date(),-1)) then add_months(to_date(concat(year(current_date())-1,'-',{{Month}},'-',1)),-13)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else add_months(to_date(concat(year(current_date()),'-',{{Month}},'-',1)),-13) end&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 08:38:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24130#M16753</guid>
      <dc:creator>Sajid1</dc:creator>
      <dc:date>2022-11-03T08:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Parse Syntax error ,can anyone guide me what is going wrong here</title>
      <link>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24129#M16752</link>
      <description>&lt;P&gt;Hi @Sajid Thavalengal Rahiman​&amp;nbsp;, Have you followed the recommendation given above? Also, could you please paste the whole error with the code?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 06:31:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24129#M16752</guid>
      <dc:creator>Debayan</dc:creator>
      <dc:date>2022-11-03T06:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Parse Syntax error ,can anyone guide me what is going wrong here</title>
      <link>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24131#M16754</link>
      <description>&lt;P&gt;Glad to know! Thanks. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 04:49:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/parse-syntax-error-can-anyone-guide-me-what-is-going-wrong-here/m-p/24131#M16754</guid>
      <dc:creator>Debayan</dc:creator>
      <dc:date>2022-11-04T04:49:44Z</dc:date>
    </item>
  </channel>
</rss>

