Convert integer to string in Presto

I am trying to convert an integer (e.g. 20211008) to a string format (2021-10-08) to use as a primary key in a separate sub-query. I have tried the following:

primary_key = cast(PARSE_DATETIME(cast(integer as VARCHAR),'yyyyMMdd') as date) 

but receive an error: =' cannot be applied to varchar, date"

7 Related questions 178 Typecast string to integer 249 How do I convert an integer to string as part of a PostgreSQL query? 9 Postgres convert integer into text Related questions 178 Typecast string to integer 249 How do I convert an integer to string as part of a PostgreSQL query? 9 Postgres convert integer into text 4 Presto - hex string to int 5 Format int as date in presto SQL 0 Select Numbers Before and After String Values - Presto SQL 0 Inserting decimals in string with Presto 6 Convert array(double) to varchar in Presto 0 string to integer in postgres 2 convert int to string in postgresql? Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like