Teradata Cast BIGINT to String
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.
CAST BIGINT to VARCHAR
SEL CAST(-9223372036854775808 AS VARCHAR(100))
Result:
-9223372036854775808.
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)))
Result:
Trim(TRAILING '.' FROM -9223372036854775808.)
1 -9223372036854775808
Use TO_CHAR function
Alternatively, use TO_CHAR function directly:
SEL TO_CHAR(-9223372036854775808)
Result:
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.
comment Comments
No comments yet.
Log in with external accounts
warning Please login first to view stats information.
article
Load JSON File into Teradata via BTEQ
article
Save DataFrame to SQL Databases via JDBC in PySpark
article
Teradata SUBSTRING / SUBSTR and REGEXP_SUBSTR Functions
article
Calculate Teradata Database Size
article
Install Teradata Express 15.0.0.8 by Using VMware Player 6.0 in Windows
Read more (73)