Hello All,
I am new to the community. I need your expert advise for an issue that I am facing...
I am trying to create a workflow with user's inputs and eventually generate a SQL query based on the input. This query is then dynamically executed against our Snowflake database. The table has a few columns that has space in between, Eg. "One Column", and my dynamic query is throwing error near the position of these columns. I am using Dynamic Input tool to run the query against the DB. Could you please help me to fix this? Thank you in advance!
Best,
Solved! Go to Solution.
Hi @geeman
Is the problem spaces in database table fields?
What is the database the query is running against? I know for SQL Server we have table fields with spaces, but the field names are enclosed in brackets, like this [Column One] and we have no problems. In other databases, you can enclose the field name in quotations and handle spaces.
Adding onto @Philip's comment, in MySQL, you would use back ticks
SELECT `First Name` from Customers;
Thanks for the reply, @Philip & @adm510. We are using Snowflake data warehouse and ([]) are not allowed in the query. I tried using the single quote but it was throwing error against the preceding AND condition in the WHERE clause. So I am enclosing the column name in '()' as ('Column Name' = 'Column Value') and this seems to work. Thanks for your help! Appreciate it.
User | Count |
---|---|
17 | |
15 | |
15 | |
8 | |
6 |