<?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 Add leading zeros during SQL Load in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1649793#M731237</link>
    <description>&lt;P&gt;Hi - I'm loading data from an SQL database.&amp;nbsp; &amp;nbsp;The Employee ID field is 7 digits long and some values are dropping the leading zeros.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to add them back in my load script using:&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;left(num(CCC_EID,'0000000'),7) as CC_EID&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp;but I'm getting error messages that &lt;STRONG&gt;num&lt;/STRONG&gt; is not a valid SQL Function.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could I use in its place?&lt;/P&gt;&lt;P&gt;Any help is appreciated, the more I read the more confused I'm becoming.&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp; George&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:53:09 GMT</pubDate>
    <dc:creator>gfisch13</dc:creator>
    <dc:date>2024-11-16T01:53:09Z</dc:date>
    <item>
      <title>Add leading zeros during SQL Load</title>
      <link>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1649793#M731237</link>
      <description>&lt;P&gt;Hi - I'm loading data from an SQL database.&amp;nbsp; &amp;nbsp;The Employee ID field is 7 digits long and some values are dropping the leading zeros.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to add them back in my load script using:&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;left(num(CCC_EID,'0000000'),7) as CC_EID&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp;but I'm getting error messages that &lt;STRONG&gt;num&lt;/STRONG&gt; is not a valid SQL Function.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could I use in its place?&lt;/P&gt;&lt;P&gt;Any help is appreciated, the more I read the more confused I'm becoming.&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp; George&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:53:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1649793#M731237</guid>
      <dc:creator>gfisch13</dc:creator>
      <dc:date>2024-11-16T01:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zeros during SQL Load</title>
      <link>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1649991#M731238</link>
      <description>&lt;P&gt;Num() might be a valid SQL function for certain RDMBS, however by the looks of it, you are using QlikView syntax on the SQL query, and that breaks.&lt;/P&gt;
&lt;P&gt;So do instead something like:&lt;/P&gt;
&lt;P&gt;LOAD *,&lt;/P&gt;
&lt;P&gt;Text(Left(Num(CCC_EID, '0000000'), 7)) AS CC_EID_2 // the "_2" to avoid duplicate name fields&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;SQL SELECT ... // the SQL query goes here&lt;/P&gt;
&lt;P&gt;FROM ...&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 09:49:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1649991#M731238</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2019-11-22T09:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zeros during SQL Load</title>
      <link>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1650127#M731239</link>
      <description>&lt;P&gt;Miguel - thanks for the response.&amp;nbsp; Based on the load script I've already created I'm even more confused on where to place this line of code.&amp;nbsp; Please see my section of load script attached below, I've shortened the script to remove unneeded noise for this topic.&amp;nbsp; I tried exactly what you stated but immediately got an error.&amp;nbsp; Also I've updated the line of code to fit this section...........&lt;/P&gt;&lt;P&gt;Text(Left(Num(EMPE_ID, '0000000'), 7)) AS EE_EMPE_ID&lt;/P&gt;&lt;P&gt;Appreciate your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 13:37:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1650127#M731239</guid>
      <dc:creator>gfisch13</dc:creator>
      <dc:date>2019-11-22T13:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zeros during SQL Load</title>
      <link>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1654692#M731240</link>
      <description>&lt;P&gt;Hey George, have a look at the following Help link, I think it might help you, you have a Load statement already, but that is against a specific data source, you can also use Load statement ahead of your SQL Select in the table before that, which is where I think you want to put things in this case:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/preceding-load.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/preceding-load.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here is a Design Blog post as well that may be helpful too:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Preceding-Load/ba-p/1469534" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Preceding-Load/ba-p/1469534&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Hopefully this will get you what you need to get things working, the expression should be good as far as I can tell too!&lt;/P&gt;
&lt;P&gt;Cheers,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 16:59:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1654692#M731240</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-12-05T16:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Add leading zeros during SQL Load</title>
      <link>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1654756#M731241</link>
      <description>&lt;P&gt;Hi Brett - this is great information on a topic that I've been very confused with.&amp;nbsp; I appreciate the follow up.&amp;nbsp; The expression above did work, but, this will help me understand the 'why' things happen.&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 19:04:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-leading-zeros-during-SQL-Load/m-p/1654756#M731241</guid>
      <dc:creator>gfisch13</dc:creator>
      <dc:date>2019-12-05T19:04:56Z</dc:date>
    </item>
  </channel>
</rss>

