Alteryx SQL Editor adding spaces before and after dashes
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello everyone,
I am copying a previously opened thread, since I am encountering the exact the same issue, I just updated the version of Alteryx Desktop, the link is provided below:
Alteryx changes my sql code by adding spaces before and after dash/hypen.
Step 1 I put this functioning workflow into the SQL Editor:
Select *
from `alpha-data-main-bfg.D6_FACT_MAC.WJ_BT_APPLES`
(works great)
Step 2. Click on the Visual Query Builder and add/remove columns / change anything.
Then click back on SQL Editor and my code has changed to
Select *
from `alpha - data - main - bfg.D6_FACT_MAC.WJ_BT_APPLES`
(spaces added before and after dashes)
Now my query won't run and gives error messages indicating that the data source doesn't exist.
So i have to go back in and find/replace to remove the spaces Alteryx added.
Is this a known problem with a solution?
I'm on Version: 2021.3.4.00445
Previous thread: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Alteryx-SQL-Editor-adding-spac...
- Labels:
- Database Connection
- Help
- Input
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@NawfalMahmood from what I am tracking to, I encounter similar issues as well. I typically utilize Microsoft SQL Server Management Studio to write the preponderance of my SQL query, and then copying and pasting it in to an Input or In-DB tool afterwards. It staves off Alteryx's Query builder from adding or removing underscores from the query language and enables it to run without issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I do this via text input tool and dynamic input in-db (usually in a batch macro with some changing parameter) but same idea...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you for sharing your experience. Unfortunately, I dont utilize Microsoft SQL Server Management Studio. I am hoping to find a fix within Alteryx, not sure if this is a bug or there is a reason behind it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you for sharing your experience. I am not using in-db tool, hopefully there is a solution for regular data input tool.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@NawfalMahmood I hate to be the bearer of bad news, but that is just how the SQL Query Builder is. If you must use it (i.e. the organization does not have a data dictionary which tells you what fields are what) then use the Query Builder. Then, once you have selected all of your fields, copy/paste that over to some word processor (Word, Notepad) and then change the table name through a CTRL+F + Replace. Once the query is converted to what it ought to be, you can copy/paste it back in your query builder window. Once that restructured query is loaded, your workflow should run without issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi all,
I am having a similar issue with spaces being added to code, resulting in an error.
My code works at first:
"AND TMP1.[Row_Num] = (SELECT TMP1.[Row_Num]-2
FROM TMP1
WHERE TMP1.[Date] = CAST(GETDATE() as DATE))"
but, if you open the editor, it changes to:
"AND TMP1.[Row_Num] = (SELECT TMP1.[Row_Num] - 2
FROM TMP1
WHERE TMP1.[Date] = CAST(GETDATE() as DATE))"
All that changes, are the additional spaces of the minus two.
This however, results in the code not working.
I have tried putting brackets around various parts, but the same happens.
Any thoughts??
Thanks, Phil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Obviously this is part of a larger code sequence!
