Re: Need help formatting Float data type for leading zeros

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 04/13/04

  • Next message: Vishal Parkar: "Re: another question"
    Date: Tue, 13 Apr 2004 16:25:12 +0200
    
    

    On Tue, 13 Apr 2004 06:01:06 -0700, Zachariah wrote:

    >I have an existing query in Access 2000 that I'm converting to a SQL view. One of my returned columns current syntax is:
    >
    >Format([tblFoo.NoteAmount]), "00000000.00") AS NoteAmount
    >
    >If I give it a value of 10400.56 it will give me 00010400.56 as NoteAmount in the resulting data set.
    >If I give it a value of 94.00 it will give me 00000094.00 as NoteAmount in the resulting data set.
    >
    >I can't seem to port this to a view. the "FORMAT" function isn't allowed and I can't get the NoteAmount which is a Float data type to cast or convert the way I want it.
    >
    >Any ideas?

    Hi Zachariah,

    The best solution is to do all formatting on the front end.

    The second best solution is:

    SELECT RIGHT('00000000'
                + CAST(CAST NoteAmount AS Money) AS varchar), 10)

    By the way: if the contents of NoteAmount are what it's name implies,
    you'd probably be better off using datatype money instead of float.

    Best, Hugo

    -- 
    (Remove _NO_ and _SPAM_ to get my e-mail address)
    

  • Next message: Vishal Parkar: "Re: another question"

    Relevant Pages