Length of Integer

Database
N/A

Length of Integer

Hi, whats the syntax to find out the length of an integer?

The Length() syntax i use for finding the length of a char doesn'w work and my experimentation with Casting to char has not worked as i have wanted it to.

Thanks
3 REPLIES
Enthusiast

Re: Length of Integer

The length of an integer is always 4 bytes (32 bits).
Enthusiast

Re: Length of Integer

Hi,
First You need to cast your integer column to varchar and then use characters
or character_length function to find out the length of the column.
For ex:
SELECT CHARACTER_LENGTH(CAST(COL1 AS VARCHAR(10))) FROM TABLE1;

--Aravind
Teradata Employee

Re: Length of Integer

Integer, represents a 32-bit (4-byte) signed integer.
Range:  -2,147,483,648 to 2,147,483,647.