Search code examples
sqlibm-midrangedb2-400

How do I select field first 8 positions only in a view


How do I select the order field (MDORDR) first 8 positions only in a view ?

I need to have a View that will give me the order number (MDORDR) but only the first 8 positions. The Varsity Shipping systems adds 2 positions to this number to make it 10 long, (for numbr of cartons per the order). how to give me in the view the first 8 only along with the weight column.

Specify CREATE VIEW Statement

ype subselect information.  Press F4 for a list.                              

 FROM files . . . . . . .   SHP4VAR27F.MFD1MD                                 

 SELECT fields  . . . . .   concat digits(MDORDR 8), MDAWGT                   

 WHERE conditions . . . .                                       

Solution

  • Is this what you want?

    select left(MDORDR, 8) as first8, MDAWGT
    from files
    where conditions;