Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

CASE STATEMENT using IN DB Formula

tjamal1
8 - Asteroid

Hi i am trying to run this CASE STATEMENT in INDB forumula tool but its not working 

 

Case
WHEN LEFT("CustomerKey",2) == '0.'
then REPLACE("CustomerKey",'.0','')
else "CustomerKey"

END

 

Error: Formula In-DB (37): Error: Microsoft SQL Server Native Client 11.0: Incorrect syntax near '='.\42000 =

 

Note: CustomerKey is ineger32 type 

1 REPLY 1
RolandSchubert
16 - Nebula
16 - Nebula

Hi @tjamal1 ,

 

try:

Case
WHEN LEFT("CustomerKey",2) = '0.'
then REPLACE("CustomerKey",'.0','')
else "CustomerKey"

END

 

I think, SQL Server handles both LEFT and REPLACE by internal type conversion, so the only unknown part is "==",
has to be replaced by "=".

 

Letr me know, if this solves the problem.

 

Best,

 

Roland

Labels
Top Solution Authors