This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
For me the sql standard for beginning a comment and ending a comment syntaxworks just fine. For example
/*insert your comment between the asterisks*/
Editing the way the query writes the full path isn't possible. But you can rename selected columns by typing inside of the "Alias" option within the bottom pane of the visual query builder when individual columns are selected.
I attached a screenshot of how i've commented on a basic query without any errors. I did find a couple of things while testing this out.
One finding is that the comments does get removed if you have the query builder change your query. Is that what is happening for you?
Another finding is that the if the comment is inserted before the query itself it errors out. Not sure why but I see that happening on my end and was wondering if you were experincing the same. if so try placing it after your query and see if that works.
As @AndréB mentions, the Visual Query Builder tab can "reconfigure" you SQL code, so I wouldn't rely on having your code retain formatting or comments inside the tool.
If you are wanting to have the code documented with comments, etc. in a more readable format within a workflow so others can reference it, a suggestion would be to copy the code you have written with all of the documentation and format that you want, and paste it into a Comment tool and place right below the Connect In-DB tool.
This way it is always in the form you want with the comments.
- yes; i noticed that the comments and format change when i switch from the SQL Editor to the Visual Query Builder and back (Cf. Rod message). A manoeuvre to avoid :-)
- i have made several test with comments in the code : sometimes it works, even when the comments is inside the code, not just at the end, and sometimes it fails. To unstable for me. I'll take Rod's suggestion : write the code with comments in a comment box, and paste and copy in the Connect In-DB box with some cleaning of the comments in case of error message !
it would be really helpful to fix this.. how often do you want your comments at the end of your SQL instead of the beginning? nobody will ever know they're there.
i understand putting the comments in a comment tool in the alteryx workflow instead - but this isn't visible to anybody else. SQL DBAs can see the code you're running, and it's helpful to have comments at the top of your code to trace ownership, purpose, etc which the DBA would be able to see. if it's just in your alteryx workflow, they can't see any of that
It would also be helpful for Analytical App Workflows.
I have a query in a dynamic input where I have lines in the where clause commented out. The user can choose from a checklist what they want to query for and then update the query code with a text box value. The action tool has an 'update value with formula' and i have the formula uncommenting the line if the user check marks the box. I cannot do this since it wont work with commented lines. The only way the app i made will work in this format is if the user check marks all the boxes, uncommenting all of the sql lines.