Teradata Cast BIGINT to String

access_time 20 days ago visibility9 comment 0

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.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to publish your article on Kontext?

Learn more

More from Kontext

visibility 5046
thumb_up 1
access_time 11 months ago

In ANSI SQL, you can use DATEADD function to easily add or subtract days/week/months/years from a date as the following code snippet shows: SELECT DATEADD ( month , 1 , '20060830' ); SELECT DATEADD ( day , - 1 , '20060831' ); However in Teradata this function is not implemented and you ...

visibility 645
thumb_up 0
access_time 6 months ago

In article   Teradata SQL - Use OREPLACE to Replace or Remove Characters , it shows how to use OREPLACE function in Teradata to replace or remove strings. This page will show one more alternative way of doing that using regular expressions. select oreplace('Kontext is a website for data ...

visibility 8393
thumb_up 0
access_time 6 years ago

In this post, I will demonstrate how to connect to Teradata database via .NET Data Provider for Teradata using C#. Install the .NET Data Provider for Teradata from the following link: Teradata Tools and Utilities Windows Installation Package Name it as’' ‘ConsoleApps.Teradata’. Add ...