<?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: ALIAS Not accepted 42601 in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107166#M9630</link>
    <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;aliases must be strings. If your column alias contains space, special character, or is a number, then grab it within a backticks. See example below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;select 
  order_id,                     -- No Alias - Works
  order_id as ORDER_ID,         -- String - Works
  -- order_id as "ORDER_ID",    -- Double quotes - Syntax Error
  -- order_id as 'orderid',     -- Single quotes - Syntax Error
  -- order_id as _@+$,          -- Specia chars - Syntax Error
  order_id as `_@+$`            -- Backticks - Works
from my_view&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arek_must_0-1737968328773.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14342i6C24ADDA2B07F215/image-size/medium?v=v2&amp;amp;px=400" role="button" title="arek_must_0-1737968328773.png" alt="arek_must_0-1737968328773.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Table alias should have been used without&amp;nbsp;&lt;SPAN&gt;quotes&amp;nbsp;&lt;/SPAN&gt;as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jan 2025 09:03:12 GMT</pubDate>
    <dc:creator>arekmust</dc:creator>
    <dc:date>2025-01-27T09:03:12Z</dc:date>
    <item>
      <title>ALIAS Not accepted 42601</title>
      <link>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107103#M9629</link>
      <description>&lt;P&gt;I am unable to run the following query generated from my backend at databricks side&lt;BR /&gt;&lt;BR /&gt;Query:&amp;nbsp;&lt;BR /&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;SELECT "&lt;/SPAN&gt;&lt;SPAN class=""&gt;A".`cut&lt;/SPAN&gt;&lt;SPAN class=""&gt;` AS "Cut&lt;/SPAN&gt;&lt;SPAN class=""&gt;" ,&lt;/SPAN&gt;&lt;SPAN class=""&gt; "&lt;/SPAN&gt;&lt;SPAN class=""&gt;A".`color&lt;/SPAN&gt;&lt;SPAN class=""&gt;` AS "Color&lt;/SPAN&gt;&lt;SPAN class=""&gt;" ,&lt;/SPAN&gt;&lt;SPAN class=""&gt; "&lt;/SPAN&gt;&lt;SPAN class=""&gt;A".`carat&lt;/SPAN&gt;&lt;SPAN class=""&gt;` AS "Carat&lt;/SPAN&gt;&lt;SPAN class=""&gt;" ,&lt;/SPAN&gt;&lt;SPAN class=""&gt; "&lt;/SPAN&gt;&lt;SPAN class=""&gt;A".`clarity&lt;/SPAN&gt;&lt;SPAN class=""&gt;` AS "Clarity" FROM &lt;/SPAN&gt;&lt;SPAN class=""&gt;databricksconnect.default.diamonds&lt;/SPAN&gt;&lt;SPAN class=""&gt; "A"&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;Error logs:&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Caused by: &lt;/SPAN&gt;&lt;SPAN class=""&gt;com.pega.pegarules.pub.database.DatabaseException&lt;/SPAN&gt;&lt;SPAN class=""&gt;: Unable to query the database: code: 500051 &lt;/SPAN&gt;&lt;SPAN class=""&gt;SQLState&lt;/SPAN&gt;&lt;SPAN class=""&gt;: 42601 Message: [Databricks][&lt;/SPAN&gt;&lt;SPAN class=""&gt;JDBCDriver&lt;/SPAN&gt;&lt;SPAN class=""&gt;](&lt;/SPAN&gt;&lt;SPAN class=""&gt;500051) ERROR processing query/statement. Error Code: 0, SQL state: 42601, Query: SELECT "A"***, Error message from Server: &lt;/SPAN&gt;&lt;SPAN class=""&gt;org.apache.hive.service.cli.HiveSQLException&lt;/SPAN&gt;&lt;SPAN class=""&gt;: Error running query: [PARSE_SYNTAX_ERROR] &lt;/SPAN&gt;&lt;SPAN class=""&gt;org.apache.spark.sql.catalyst.parser.ParseException&lt;/SPAN&gt;&lt;SPAN class=""&gt;: &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near '"Cut"'. SQLSTATE: 42601 (line 1, pos 20)&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 05:02:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107103#M9629</guid>
      <dc:creator>malhm</dc:creator>
      <dc:date>2025-01-27T05:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: ALIAS Not accepted 42601</title>
      <link>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107166#M9630</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;aliases must be strings. If your column alias contains space, special character, or is a number, then grab it within a backticks. See example below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;select 
  order_id,                     -- No Alias - Works
  order_id as ORDER_ID,         -- String - Works
  -- order_id as "ORDER_ID",    -- Double quotes - Syntax Error
  -- order_id as 'orderid',     -- Single quotes - Syntax Error
  -- order_id as _@+$,          -- Specia chars - Syntax Error
  order_id as `_@+$`            -- Backticks - Works
from my_view&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arek_must_0-1737968328773.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14342i6C24ADDA2B07F215/image-size/medium?v=v2&amp;amp;px=400" role="button" title="arek_must_0-1737968328773.png" alt="arek_must_0-1737968328773.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Table alias should have been used without&amp;nbsp;&lt;SPAN&gt;quotes&amp;nbsp;&lt;/SPAN&gt;as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 09:03:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107166#M9630</guid>
      <dc:creator>arekmust</dc:creator>
      <dc:date>2025-01-27T09:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: ALIAS Not accepted 42601</title>
      <link>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107173#M9631</link>
      <description>&lt;P&gt;Is there any way or workaround to it so that it accepts double quotes for aliases, as sql and postgres does allow the same?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 09:18:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107173#M9631</guid>
      <dc:creator>malhm</dc:creator>
      <dc:date>2025-01-27T09:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: ALIAS Not accepted 42601</title>
      <link>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107181#M9632</link>
      <description>&lt;P&gt;None that I'm aware of. You could handle this on the fly if there' s a possibility&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 09:33:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107181#M9632</guid>
      <dc:creator>arekmust</dc:creator>
      <dc:date>2025-01-27T09:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: ALIAS Not accepted 42601</title>
      <link>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107192#M9633</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146106"&gt;@malhm&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Double quotes are not supported in column alias.&amp;nbsp;In Databricks SQL/Spark SQL one uses backticks instead of double quotes like in PostgreSQL.&lt;BR /&gt;&lt;BR /&gt;Check the docs:&lt;BR /&gt;&lt;A href="https://spark.apache.org/docs/3.5.1/sql-ref-identifier.html" target="_blank"&gt;https://spark.apache.org/docs/3.5.1/sql-ref-identifier.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 10:03:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/alias-not-accepted-42601/m-p/107192#M9633</guid>
      <dc:creator>filipniziol</dc:creator>
      <dc:date>2025-01-27T10:03:25Z</dc:date>
    </item>
  </channel>
</rss>

