Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Local SQL Variables not working in Alteryx

5 - Atom

Hello everyone, 


I am having issues running a SQL Server query in Alteryx. My assumption is that it is related to the local variables that were created by the developer and Alteryx not being able to read in those variables. 


Is there a proper way to get those variables written in so the data runs through Alteryx?


Is the correct way to place the variable portion of the query in the "PRE SQL Statement" section and the entire query in to the "Table or Query" section?


Any help would be appreciated. 



Alteryx Alumni (Retired)

Hi @adam32291,


Yes you can add a Pre-SQL statement to your connections. Under options on the configuration panel of the input source in question take a look at option 9, it allows you to add a statement, further option 11 gives you the ability to add a Post-SQL statement



5 - Atom

Thank you. I tried this, but unfortunately still getting an error. Invalid cursor state and an error executing PostSQL


Does any of the below SQL look incorrect in declaring variables?