Alteryx Designer Desktop Discussions

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

SQL: Problems with Extract

neromerob
10 - Fireball

Hello to everyone.

I´m writing because I have a problem extracting the last value of a field

the code that i wrote is similar to this one

 

SELECT
,substring(RUT,1,length(RUT)-1) AS TEST_1
RUT
FROM TABLE1

 

the result that i need should look like this

 

Captura.JPG

 

Keep in mind that RUT is INTEGER so i don´t know is that could be a problem.

 

I have to do this First in Database before i even work in the workflow.

 

Regards.

 

2 REPLIES 2
binuacs
20 - Arcturus

@neromerob @Can you covert the RUT field to char type and try again?

grazitti_sapna
17 - Castor

@neromerob, this is how you can do it. As your column is INT datatype you need to convert into STRING which can be done using str function.

select RUT,substring(str(RUT),1,len(str(RUT))-1) as Test_1 from Table_1

grazitti_sapna_0-1659681037132.png

 

I hope that helps!

 

Thanks!

 

Sapna Gupta
Labels