简体   繁体   中英

Convert date to string in Teradata

I'm trying to convert a date to string in Teradata. I've found on the Internet that it can be done like this:

SELECT TO_CHAR(CURRENT_DATE, 'YYYYMMDD')

But this returns an error:

SELECT Failed. 3706: Syntax error: expected something between '(' and the 'CURRENT_DATE'
keyword.

If I run that exact same command on another Teradata database I have access to, it works fine. I suspect it must be something regarding the version of Teradata, or something like that.

Is there another way to do this?

我不知道为什么会收到此错误,但是您也可以使用以下方法执行所需的操作:

CURRENT_DATE(FORMAT 'YYYYMMDD') (CHAR(8))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM