community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

How to correctly set up CASE statement in an Formula In-DB tool?

Asteroid

I'm trying to calculate a new field in my In-DB workflow, but I keep getting 'Unable to prepare query' error.

 

I need to set this up in an In-DB workflow, as I'll be moving a rather big table within a DB, so processing outside of DB would be inefficient time-wise.

 

This is how my Formula In-DB is set up now - if anyone with more experience using SQL in Alteryx can help spotting what is wrong with it, I'd appreciate that very much.

To be clear - I want to create a field called 'KPCI_LEVEL' based on the values of field called 'FUNCTION_LEVEL_OBJECT'. 'FUNCTION_LEVEL_OBJECT' has numeric data type.

 

CASE sql.png

Quasar
Hi, I believe you do not need the semi colons on every line. You probably only need add it to the last line
Quasar
I would also try removing CASE at the end
Asteroid

Thanks for suggestions - unfortunately, the query still throws errors.

 

I found a way to get around that - I created reference table in Text Input and joined that to my data. Who needs SQL when you have Alteryx :)

 

 

Labels