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?
Solved! Go to Solution.
@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...
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).
That got it, thanks! /k was useful for debugging too.