<?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: SQL select string and turn it into a decimal in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-select-string-and-turn-it-into-a-decimal/m-p/8646#M4231</link>
    <description>&lt;P&gt;Hi @Chris Chung​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2023 05:02:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-03-13T05:02:02Z</dc:date>
    <item>
      <title>SQL select string and turn it into a decimal</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-select-string-and-turn-it-into-a-decimal/m-p/8644#M4229</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;select
    col as original,
    col::double as val_double,
    col::float as val_float,
    col::decimal(10,4) as val_decimal,
    to_number(col, '99999.99999') as val_tonum
from int_fx_conversion_rate;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The original value of col is a string such as '1.2345' out to 4 decimal places. When I run this above, all of the casted versions come out rounded to 2 decimal places (1.23). How do I get all the decimals?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 16:28:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-select-string-and-turn-it-into-a-decimal/m-p/8644#M4229</guid>
      <dc:creator>maxutil</dc:creator>
      <dc:date>2023-02-27T16:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: SQL select string and turn it into a decimal</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-select-string-and-turn-it-into-a-decimal/m-p/8645#M4230</link>
      <description>&lt;P&gt;@Chris Chung​&amp;nbsp;: The issue you're experiencing is likely due to the default rounding behavior  in SQL. To preserve all the decimal places, you can modify your query to cast the column as a string. Example: CAST(col AS STRING) AS col_string. Please try this.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 01:26:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-select-string-and-turn-it-into-a-decimal/m-p/8645#M4230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-09T01:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: SQL select string and turn it into a decimal</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-select-string-and-turn-it-into-a-decimal/m-p/8646#M4231</link>
      <description>&lt;P&gt;Hi @Chris Chung​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 05:02:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-select-string-and-turn-it-into-a-decimal/m-p/8646#M4231</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-13T05:02:02Z</dc:date>
    </item>
  </channel>
</rss>

