Truncating character column

Database
Enthusiast

Truncating character column

Hi all,

I have data like 'Mytable123' in my source table. First 8 letters in my source data is alphabets rest are numbers. but i need only integer portion without using CASE statement. help me how to do this.

Thanks
Sen

3 REPLIES
Enthusiast

Re: Truncating character column

If the first 8 characters are always alphabets why can't you do a substr(field,9)
Enthusiast

Re: Truncating character column

Is it possible to do without substring function....?
Teradata Employee

Re: Truncating character column

Hello,

As I believe, there are several ways to solve a given problem.... but not all may be the best possible.

If you are not comfortable using built-in functions/best possible solution....you can always write your own UDF or perhaps the stored-procedure (can't be used in SELECT/INSERT/UPDATE). BUT....it won't be logical enough.

So, summary is, best option is to use SQL built-in function, just an option is to over-kill it and develop a UDF or SP.

HTH!

Regards,

Adeel