<?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: No Columns returned for dynamic SQL query in Alteryx Designer Desktop Discussions</title>
    <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412138#M350004</link>
    <description>&lt;P&gt;&lt;a href="https://community.alteryx.com/t5/user/viewprofilepage/user-id/520347"&gt;@KGT&lt;/a&gt;&amp;nbsp;Yes, each successive script must be completed before the next one launches as many are dependent upon each other. If that didn't matter I would just use the Run Command tool to launch powershell scripts.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Sep 2025 12:13:15 GMT</pubDate>
    <dc:creator>csh8428</dc:creator>
    <dc:date>2025-09-05T12:13:15Z</dc:date>
    <item>
      <title>No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1411992#M349951</link>
      <description>&lt;P&gt;I need to execute a bunch of SQL scripts that need to be executed in order as they are dependent upon each other. The workflow modifies some of the date values within each script. The scripts are stored locally(this is a requirement).&lt;/P&gt;&lt;P&gt;My plan was to feed each script into a dynamic input in a control container and connect the control containers to control the sequence order. These scripts are fully self-contained and do all the DROPS, CREATES, and WRITES.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The tables are correctly read from/written to, but I am getting the error "&lt;EM&gt;No columns returned&lt;/EM&gt;". Based on some google-fu this because there are no results being returned; which makes sense because this is true. I've tried several methods of adding an additional statement on the end to get some "results", but that hasn't worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL attached below. Anyone have any other ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;-- Step 1: Clear all data from the destination table.
-- TRUNCATE TABLE is used for performance as it's a minimally logged operation.
TRUNCATE TABLE [Sandbox].[dbo].[WRITE_TEST_2];

-- Step 2: Copy all data from the source table to the destination table.
-- It assumes the column structure of both tables is identical.
INSERT INTO [Sandbox].[dbo].[WRITE_TEST_2]
SELECT *
FROM [Sandbox].[dbo].[WRITE_TEST_1]
WHERE BegindDate = '1901-01-01' AND EndDate = '1901-12-31';

-- Step 3: Return a result set to avoid the "no columns returned" error.
-- @@ROWCOUNT returns the number of rows affected by the last statement (the INSERT).
-- This provides a meaningful result and confirms the operation's success.
SELECT @@ROWCOUNT AS RowsCopied;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2025 16:17:51 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1411992#M349951</guid>
      <dc:creator>csh8428</dc:creator>
      <dc:date>2025-09-04T16:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1411998#M349952</link>
      <description>&lt;P&gt;Yes, Control Containers could be used to sequence.&lt;BR /&gt;&lt;BR /&gt;I am curious though why this approach?&amp;nbsp; Maybe i'm overly simplifying this but could you:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Bring in SQL-based data&lt;/LI&gt;&lt;LI&gt;Filter the dates in your workflow&lt;/LI&gt;&lt;LI&gt;Output the data back into the DB&lt;/LI&gt;&lt;LI&gt;Use Pre-SQL to Truncate before the insert&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To avoid the empty rows issue, the Control Container would work well to perform a conditional test.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Jay&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2025 16:26:08 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1411998#M349952</guid>
      <dc:creator>jrlindem</dc:creator>
      <dc:date>2025-09-04T16:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412008#M349954</link>
      <description>&lt;P&gt;&lt;a href="https://community.alteryx.com/t5/user/viewprofilepage/user-id/402073"&gt;@jrlindem&lt;/a&gt;&amp;nbsp;The sql script I gave is just a very small example. The actual scripts are hundreds of lines and do multiple drops, creates, etc... We need the scripts to exist on a shared drive for transparency purposes that can be edited outside of Alteryx. In this case, Alteryx is just being used to execute a series of physical scripts in a specific order. No ETL is being done in Alteryx other than changing some date variables in the scripts.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2025 17:07:40 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412008#M349954</guid>
      <dc:creator>csh8428</dc:creator>
      <dc:date>2025-09-04T17:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412011#M349956</link>
      <description>&lt;P&gt;&lt;a href="https://community.alteryx.com/t5/user/viewprofilepage/user-id/26425"&gt;@csh8428&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Ya, I kind of suspected that was going to be the case.&amp;nbsp; Given that you have "edit" permissions back to your database, I feel like (if it was me) I'd probably opt to build out your solutions using procedures/tasks in... dare I say, the database itself instead of in Alteryx&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grimacing_face:"&gt;😬&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2025 17:12:07 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412011#M349956</guid>
      <dc:creator>jrlindem</dc:creator>
      <dc:date>2025-09-04T17:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412043#M349965</link>
      <description>&lt;P&gt;&lt;a href="https://community.alteryx.com/t5/user/viewprofilepage/user-id/402073"&gt;@jrlindem&lt;/a&gt;&amp;nbsp;I'm gonna pretend you didn't say that. ;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2025 19:52:34 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412043#M349965</guid>
      <dc:creator>csh8428</dc:creator>
      <dc:date>2025-09-04T19:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412075#M349981</link>
      <description>&lt;P&gt;Does it matter as to whether anything has completed with the script, or is it just running them in order? I would feed the scripts into a batch Macro, so that way one script will execute at a time, and then the next etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think you have the right method in terms of using @@ROWCount so that something is returned. If you want to do it without returning something, then it will require a little mucking around, as that's not the way Alteryx works. It could definitely be done, but wouldn't be as native and would be harder to track/update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some other points:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The advantage of using @@ROWCount or similar is that you can report on each one as well in the Alteryx Workflow.&lt;/LI&gt;&lt;LI&gt;You could even set up a proc on the DB that gives other stats, and call that at the end of each script.&lt;/LI&gt;&lt;LI&gt;The Batch Macro could either have the DB connection already configured, or take the details in per run...&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As to running them, you have the option of (I advise Dynamic Input):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Input (Pre-SQL),&lt;/LI&gt;&lt;LI&gt;Dynamic Input (I advise loading them to a tool, and then inputting to Dynamic Input with "Replace a specific string"),&lt;/LI&gt;&lt;LI&gt;In-DB (These could be a little funky inside a macro... I haven't done it in years and so can't remember)&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 05 Sep 2025 03:38:24 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412075#M349981</guid>
      <dc:creator>KGT</dc:creator>
      <dc:date>2025-09-05T03:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412138#M350004</link>
      <description>&lt;P&gt;&lt;a href="https://community.alteryx.com/t5/user/viewprofilepage/user-id/520347"&gt;@KGT&lt;/a&gt;&amp;nbsp;Yes, each successive script must be completed before the next one launches as many are dependent upon each other. If that didn't matter I would just use the Run Command tool to launch powershell scripts.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2025 12:13:15 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412138#M350004</guid>
      <dc:creator>csh8428</dc:creator>
      <dc:date>2025-09-05T12:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: No Columns returned for dynamic SQL query</title>
      <link>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412280#M350028</link>
      <description>&lt;P&gt;OK, then I recommend a Batch Macro, so that one executes at a time. There are so many different ways you could do that, but the simple method will have the Batch Macro taking the script as the control parameter each batch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recommend keeping your&amp;nbsp;@@ROWCOUNT, as that will be an output for each batch. You could make this fancier by customising the output on each script and having that return, but that's not the main focus here.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2025 02:48:00 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/No-Columns-returned-for-dynamic-SQL-query/m-p/1412280#M350028</guid>
      <dc:creator>KGT</dc:creator>
      <dc:date>2025-09-08T02:48:00Z</dc:date>
    </item>
  </channel>
</rss>

