Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Formatting Text
Mon, Sep 19 2011 10:37 PMPermanent Link

Alex Vastich

Hi,

I am creating an export file and therefore have fixed formats I have to adhere to.  I am wondering what is the best way to handle these in DBISAM V3 SQL.  Examples of a requirement is below:

* Zero-filled formatted numeric with 2 decimal places characters

eg if value is 17.5 need it to be output as 0001750

I have tried CAST etc without much success.

Thanks Kindly

Alex
Tue, Sep 20 2011 3:16 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Alex


I don't know about V3 but for V4

select
SUBSTRING('0000000000',1,10-LENGTH(  CAST(ROUND(100*17.5123 ,0) AS VARCHAR(10))))+
CAST(ROUND(100*17.5123 ,0) AS VARCHAR(10))
from banda


Its messy but it works. I used constants only because I use ElevateDB and couldn't remember where I had a decimal column in the DBISAM tables

Roy Lambert [Team Elevate]
Tue, Sep 20 2011 6:12 AMPermanent Link

Alex Vastich

Roy Lambert wrote:

Wow thanks Roy I'll give it a go.
Image