All Forums Database
Senthilkumar 14 posts Joined 08/07
14 Apr 2009
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.ThanksSen

samit_9999 37 posts Joined 03/06
14 Apr 2009

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

Senthilkumar 14 posts Joined 08/07
15 Apr 2009

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

Adeel Chaudhry 773 posts Joined 04/08
15 Apr 2009

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

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.