Alteryx Designer Desktop Discussions

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

Change length for field with '0' use Formula in-DB

TessaXu
6 - Meteoroid

I want to adjust the length of a string field and fill '0' in left in Formula in-DB, and get an error message as below image.

 

I have limited knowledge on SQL in-DB formula, so I think there is some wrong in my SQL expression. Hope I can get some hints in Community.

 

Thank you so much.

TessaXu_0-1676015874096.png

 

2 REPLIES 2
DataNath
17 - Castor

Hey @TessaXu, could you try the following?

 

RIGHT(REPLICATE('0',12) + "SALES_DOCUMENT",12)

 

If you have any further issues, I'd double check the datatype of the incoming [Sales Document] field. If it's numeric you could just CONVERT() within the function using an expression along these lines:

 

RIGHT(REPLICATE('0',12) + CONVERT(VARCHAR,"Product Line"),12)
TessaXu
6 - Meteoroid

Hi, it works when I use the statement add CONVERT() .

Great thanks for your quick reply, have a nice day.

Labels