Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Run Command Tool - cmd.exe runs perfectly until I use the run command tool

Paul-JSY
6 - Meteoroid

Hi all,

 

I'm using sqlcmd via cmd.exe to run a SQL Script on a SQL Server Instance as Alteryx appears unable to do this natively.

 

If I open cmd on my machine and enter the command manually it executes perfectly and writes the result to the specified csv file:

 

sqlcmd -S tcp:[servername],50001 -d [databasename] -M -K ReadOnly -s , -i "[filepath]\IP007DM_Iteration_NonSP.sql" -o "[Filepath]\IP007DM.csv"

 

 

However, if I use the Run Command tool or Run Command event, It opens a command prompt window but doesn't pass the command and just sits as running indefinitely.  If I manually enter my command into the cmd window that Alteryx opens I get the error: "'sqlcmd' is not recognized as an internal or external command, operable program or batch file."

 

It's as if Alteryx is using a different version of cmd.exe somehow, even though I'm specifying the exact same executable I use when running manually.

 

Any ideas please?

3 REPLIES 3
patrick_digan
17 - Castor
17 - Castor

@Paul-JSY try adding /c and then a space before sqlcmd. Hopefully that's all you need!

 

Credit to the one and only @jdunkerley79 in this post https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Run-Command-Tool-Error/td-p/91...

 

patrick_digan
17 - Castor
17 - Castor

you could also use /k instead of /c if you wanted to keep the command prompt open while debugging. Note that you would need to manually close the command prompt window and alteryx will return an error (so useful for debugging but then use /c in production).

 

image.png

image.png

Paul-JSY
6 - Meteoroid

That got it, thanks!  /k was useful for debugging too.

Labels