<?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 sql: how to convert datatype of column? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-how-to-convert-datatype-of-column/m-p/29781#M21488</link>
    <description>&lt;P&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Bricklayers,
I want to port this sql statement from sqlite to databricks:
select cast(myage as number) as my_integer_age from ages;
Does databricks allow me to do something like this?&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2016 23:05:49 GMT</pubDate>
    <dc:creator>dan11</dc:creator>
    <dc:date>2016-03-07T23:05:49Z</dc:date>
    <item>
      <title>sql: how to convert datatype of column?</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-how-to-convert-datatype-of-column/m-p/29781#M21488</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Bricklayers,
I want to port this sql statement from sqlite to databricks:
select cast(myage as number) as my_integer_age from ages;
Does databricks allow me to do something like this?&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 23:05:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-how-to-convert-datatype-of-column/m-p/29781#M21488</guid>
      <dc:creator>dan11</dc:creator>
      <dc:date>2016-03-07T23:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: sql: how to convert datatype of column?</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-how-to-convert-datatype-of-column/m-p/29782#M21489</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;@dan11 &lt;/P&gt;
&lt;P&gt;We don't support &lt;PRE&gt;&lt;CODE&gt;number&lt;/CODE&gt;&lt;/PRE&gt; in Spark SQL. Try using &lt;PRE&gt;&lt;CODE&gt;int&lt;/CODE&gt;&lt;/PRE&gt;, &lt;PRE&gt;&lt;CODE&gt;double&lt;/CODE&gt;&lt;/PRE&gt;, &lt;PRE&gt;&lt;CODE&gt;float&lt;/CODE&gt;&lt;/PRE&gt;, and your query should be fine. To run SQL in a notebook, just prepend any cell with %sql.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;%sql
select cast(myage as double) as my_integer_age from ages;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 19:21:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-how-to-convert-datatype-of-column/m-p/29782#M21489</guid>
      <dc:creator>raela</dc:creator>
      <dc:date>2016-03-08T19:21:03Z</dc:date>
    </item>
  </channel>
</rss>

