<?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: Dynamical generate values with Script Activity with SQL Insert in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4824982#M8510</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Build the VALUES string in one go&lt;/STRONG&gt; (preferred solution to try)&lt;/P&gt;&lt;P&gt;Instead of looping, you can use an expression to flatten your array into a SQL VALUES string.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;@concat(
  'INSERT INTO mytbl (mynum, myval) VALUES ',
  join(
    select(activity('Lookup1').output.value, concat('(', item().mynum, ', ''', item().myval, ''')')),
    ','
  )
)&lt;/LI-CODE&gt;&lt;P&gt;This generates the following,&amp;nbsp;You can then feed this single string into a &lt;STRONG&gt;Script activity&lt;/STRONG&gt; as @{...}.&lt;/P&gt;&lt;P&gt;INSERT INTO mytbl (mynum, myval) VALUES (1,'A'),(2,'A'),(3,'ZZ')&lt;/P&gt;&lt;P&gt;/Or/&lt;/P&gt;&lt;H4&gt;&lt;STRONG&gt;ForEach + Script (row-by-row)&lt;/STRONG&gt;&lt;/H4&gt;&lt;P&gt;If the dataset is small and you do not care about performance, wrap your INSERT in a ForEach.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will execute one insert per item. It is slower but easier to reason about.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Inside ForEach, use Script activity with:&amp;nbsp;INSERT INTO mytbl (mynum, myval) VALUES (@{item().mynum}, '@{item().myval}')&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Sat, 13 Sep 2025 07:32:38 GMT</pubDate>
    <dc:creator>Vinodh247</dc:creator>
    <dc:date>2025-09-13T07:32:38Z</dc:date>
    <item>
      <title>Dynamical generate values with Script Activity with SQL Insert</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4824813#M8509</link>
      <description>&lt;P&gt;Say I have a return array from a lookup activity as follows:&lt;BR /&gt;&lt;SPAN&gt;[ { "mynum": 1, "myval": "A" },{ mynum": 2, "myval": "A" },{ mynum": 3, "myval": "ZZ" }]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And I want to insert these rows into mytbl in a script activity.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is it possible to create the string VALUES statement dynamically? I thought of for-each and set variable activity, but can not reference the variable in the set variable activity.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2025 19:22:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4824813#M8509</guid>
      <dc:creator>P_work</dc:creator>
      <dc:date>2025-09-12T19:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamical generate values with Script Activity with SQL Insert</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4824982#M8510</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Build the VALUES string in one go&lt;/STRONG&gt; (preferred solution to try)&lt;/P&gt;&lt;P&gt;Instead of looping, you can use an expression to flatten your array into a SQL VALUES string.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;@concat(
  'INSERT INTO mytbl (mynum, myval) VALUES ',
  join(
    select(activity('Lookup1').output.value, concat('(', item().mynum, ', ''', item().myval, ''')')),
    ','
  )
)&lt;/LI-CODE&gt;&lt;P&gt;This generates the following,&amp;nbsp;You can then feed this single string into a &lt;STRONG&gt;Script activity&lt;/STRONG&gt; as @{...}.&lt;/P&gt;&lt;P&gt;INSERT INTO mytbl (mynum, myval) VALUES (1,'A'),(2,'A'),(3,'ZZ')&lt;/P&gt;&lt;P&gt;/Or/&lt;/P&gt;&lt;H4&gt;&lt;STRONG&gt;ForEach + Script (row-by-row)&lt;/STRONG&gt;&lt;/H4&gt;&lt;P&gt;If the dataset is small and you do not care about performance, wrap your INSERT in a ForEach.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will execute one insert per item. It is slower but easier to reason about.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Inside ForEach, use Script activity with:&amp;nbsp;INSERT INTO mytbl (mynum, myval) VALUES (@{item().mynum}, '@{item().myval}')&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Sat, 13 Sep 2025 07:32:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4824982#M8510</guid>
      <dc:creator>Vinodh247</dc:creator>
      <dc:date>2025-09-13T07:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamical generate values with Script Activity with SQL Insert</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4826088#M8517</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1286298" data-lia-user-login="P_work" class="lia-mention lia-mention-user"&gt;P_work&lt;/a&gt;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: SegoeUI; font-size: 11.25pt;"&gt;&lt;SPAN&gt;I would also take a moment to thank&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="640329" data-lia-user-login="Vinodh247" class="lia-mention lia-mention-user"&gt;Vinodh247&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: SegoeUI; font-size: 11.25pt; color: black;"&gt;&lt;SPAN&gt;I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Community Support Team.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 08:46:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4826088#M8517</guid>
      <dc:creator>v-hjannapu</dc:creator>
      <dc:date>2025-09-15T08:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamical generate values with Script Activity with SQL Insert</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4829722#M8537</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1286298" data-lia-user-login="P_work" class="lia-mention lia-mention-user"&gt;P_work&lt;/a&gt;,&lt;BR /&gt;I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We are always here to support you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Community Support team.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 12:16:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4829722#M8537</guid>
      <dc:creator>v-hjannapu</dc:creator>
      <dc:date>2025-09-18T12:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamical generate values with Script Activity with SQL Insert</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4831645#M8546</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1286298" data-lia-user-login="P_work" class="lia-mention lia-mention-user"&gt;P_work&lt;/a&gt;,&lt;BR /&gt;I wanted to follow up and see if you have had a chance to review the information that was shared. If you have any additional questions or need further clarification, please don’t hesitate to reach out. I am here to assist with any concerns you might have.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Community Support Team.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2025 04:05:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4831645#M8546</guid>
      <dc:creator>v-hjannapu</dc:creator>
      <dc:date>2025-09-22T04:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamical generate values with Script Activity with SQL Insert</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4855955#M8647</link>
      <description>&lt;P&gt;Did not work. Required ForEach activity with Append Variable activity. Similar to this solution:&lt;BR /&gt;&lt;A title="Formatting Array Variable as HTML" href="https://community.fabric.microsoft.com/t5/Service/Formatting-Array-Variable-as-HTML-inside-Fabric-Data-Pipeline/m-p/3933628" target="_self"&gt;https://community.fabric.microsoft.com/t5/Service/Formatting-Array-Variable-as-HTML-inside-Fabric-Data-Pipeline/m-p/3933628&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 14:45:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Dynamical-generate-values-with-Script-Activity-with-SQL-Insert/m-p/4855955#M8647</guid>
      <dc:creator>P_work</dc:creator>
      <dc:date>2025-10-22T14:45:25Z</dc:date>
    </item>
  </channel>
</rss>

