Skip to Content
0
Dec 18, 2013 at 07:54 PM

Help needed on SQL script

29 Views

Hi,

I am a bit new to data services and need some help in understanding how to write a script.

The scenario is explained as below:

There is a table having 2 columns as below:

Column A is of datatype Varchar.

COLUMN_ACOLUMN_ B100xxxa900xabc200xxxxdasds47xxxxx

Now, I need to fill a variable $Count with the maximum number of characters that any rows of column A has.

As in this case dasds47 has the most number of characters ('dasds') which is equal to 5.

The logic I am thinking is to loop on the table and again loop on the string to check if 1st letter is a number or not

(substr( TABLEA.COLUMN_A,1,1 )>='0') AND (substr( TABLEA.COLUMN_A,1,1)<='9')

Similarly check each character of each string until the length of string.

I know ABAP but am new to scripting in BODS.. can someone please help me in writing the logic.. I have no idea on how the syntax should be.