Teradata Cast BIGINT to String

visibility 1,217 access_time 2 years ago languageEnglish

Teradata BIGINT data type represents a signed, binary integer value from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. To convert BIGINT to VARCHAR data type, CAST function can be used directly. 


SEL CAST(-9223372036854775808 AS VARCHAR(100))



1 -9223372036854775808.

Remove trailing dot

Function TRIM can be used to remove the trailing dot from the above result:
SEL TRIM(trailing '.' from CAST(-9223372036854775808 AS VARCHAR(100)))
Trim(TRAILING '.' FROM -9223372036854775808.)
1 -9223372036854775808

Use TO_CHAR function

Alternatively, use TO_CHAR function directly:

SEL TO_CHAR(-9223372036854775808)
1 -9223372036854775808
*Note - there is no trailing dot char when using TO_CHAR function.
copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

timeline Stats
Page index 2.39
More from Kontext
Truncate table in Teradata
visibility 1,466
thumb_up 0
access_time 3 years ago
Teradata FastLoad with Optional Quotes
visibility 1,740
thumb_up 0
access_time 2 years ago
Extract JSON Data via SQL Functions in Teradata
visibility 1,472
thumb_up 2
access_time 2 years ago