<?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: Dynamic SQL in Data &amp; Schema Discussions</title>
    <link>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1771#M72</link>
    <description>&lt;P&gt;We have 30 different tables and each of these table names are in a look up table column. I would like to run through a loop wherein each of these table names are fetched from this lookup table and we create a dynamic select query on this table name and pull the data from this table and load all these into one table. How can this be achieved in Incorta without creating 30 different tables and 30 multiple data sources?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 19:46:31 GMT</pubDate>
    <dc:creator>sathyan75</dc:creator>
    <dc:date>2022-06-01T19:46:31Z</dc:date>
    <item>
      <title>Dynamic SQL</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1765#M69</link>
      <description>&lt;P&gt;Is there an option to build a query using variables. I have the table names in a lookup table and i would like to use that to build dynamic SQL in Incorta. Is there such an option available in Incorta?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 15:34:27 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1765#M69</guid>
      <dc:creator>sathyan75</dc:creator>
      <dc:date>2022-06-01T15:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1770#M71</link>
      <description>&lt;P&gt;What's your goal?&amp;nbsp; Is the SQL you want to build to ingest data into an Incorta table?&amp;nbsp; Or to create an Incorta derived table?&amp;nbsp; Or for a specific report output?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Incorta has a lot of flexibility built in and more available w/ notebooks so the answer is probably "yes" but to give a definite answer a specific use case would be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 18:34:26 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1770#M71</guid>
      <dc:creator>RADSr</dc:creator>
      <dc:date>2022-06-01T18:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1771#M72</link>
      <description>&lt;P&gt;We have 30 different tables and each of these table names are in a look up table column. I would like to run through a loop wherein each of these table names are fetched from this lookup table and we create a dynamic select query on this table name and pull the data from this table and load all these into one table. How can this be achieved in Incorta without creating 30 different tables and 30 multiple data sources?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 19:46:31 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1771#M72</guid>
      <dc:creator>sathyan75</dc:creator>
      <dc:date>2022-06-01T19:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1775#M73</link>
      <description>&lt;P&gt;To be clear - you have 30 tables sitting in a database and a thirty-first table containing the names of the first thirty.&amp;nbsp; You want to create a single Incorta table containing the data held within all thirty source tables and, I presume, an additional column with the source table name included?&lt;/P&gt;&lt;P&gt;Why seems to be the next logical question&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;But if you really want to do that there's going to be some manual work - just for starters you need to know how many columns to define in Incorta ( max columns + 1&amp;nbsp; I'd guess ) and then string together select &amp;lt;sourcetablename&amp;gt;, * from sourcetablename statements.&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are probably looking at a notebook using R or something similar - for that I'd start here and here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.incorta.com/t5/data-schemas-knowledgebase/getting-started-with-r-in-incorta-notebook/ta-p/844" target="_blank"&gt;https://community.incorta.com/t5/data-schemas-knowledgebase/getting-started-with-r-in-incorta-notebook/ta-p/844&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/36192437/merging-r-dataframes-with-different-number-of-columns-and-rows" target="_blank"&gt;https://stackoverflow.com/questions/36192437/merging-r-dataframes-with-different-number-of-columns-and-rows&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course this gets a lot easier if you have 30 source tables which are structurally identical and you can just use&amp;nbsp; UNION ALL between all thirty result sets&amp;nbsp; ( or just UNION if you include the original table name ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 20:45:24 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1775#M73</guid>
      <dc:creator>RADSr</dc:creator>
      <dc:date>2022-06-01T20:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1834#M76</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/227"&gt;@sathyan75&lt;/a&gt;&amp;nbsp;, did this solve your question?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 11:30:56 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/dynamic-sql/m-p/1834#M76</guid>
      <dc:creator>KailaT</dc:creator>
      <dc:date>2022-06-07T11:30:56Z</dc:date>
    </item>
  </channel>
</rss>

