Results 1 to 3 of 3

Thread: floor function

  1. #1
    Join Date
    Feb 2004
    Posts
    20

    Question Unanswered: floor function

    I am trying to pull the number preceeding the decimal, but I want my output in a fixed lengh. Here is what I tried thinking it might work, however it did not.

    sf_retail = right('000' + floor(cast(labsf.last_retail_price as varchar)),3),

    the number I am running this against is '0000001.45' I would like my output to read '001'......I am getting only '1'

    Any suggestions?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    We just did something like that....

    Check out....

    http://www.dbforums.com/t987264.html
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Feb 2004
    Posts
    20
    Thanks, that was helpful. I ended up using:

    sf_retail = right('000' + convert(varchar(3), floor(labsf.last_retail_price)),3),

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •