Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

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