Input of numeric data into a field w/datatype of float

Posted on 2007-10-04
Last Modified: 2010-03-20
I need a way to update a field in a table with a numeric number.  The field (Hours) has a datatype of "float"  so if were to update this field like so

Update Issues
set hours = '4.0'
where issuenumber = 'xxxx'

I get a displayed number that doesn't resemble the intended 4.0 hours.

So I'm looking perhaps for a sql function that will take the 4.0 hours and convert and imput them into the database so that when displayed shows the 4.0 hours.

Any help will be appreciated.

Question by:TimSweet220
    LVL 32

    Expert Comment

    by:Daniel Wilson
    What DBMS?

    Typically, omit the quotes around a number.

    Update Issues
    set hours = 4.0
    where issuenumber = 'xxxx'

    Author Comment

    MS SQL 2000

    The display is in asp and when I run the query above
     the asp page displays  96:00 instead of 4:00

    Now if entered through the asp display for example 88 hours the database shows 3.6666666666666665.  So I guess the asp is doing the converting when updating to the database.

    I may have to take this off to another section - but I was hoping to be able to update on the dbside rather then enter by hand in the asp pages.

    LVL 11

    Accepted Solution

    Are you actually using a date field?

    Suggest that the database is seeing 4.0 as 4 days and that it is returning 96:00 - 4 x 24 - i.e. 4 days in hours.
    LVL 32

    Assisted Solution

    by:Daniel Wilson
    In MS SQL Server, the SQL above will put the right figure into the DB.

    Whether your ASP, either providing the number or displaying it on retrieval, is applying other formatting, is hard to say without a look at that code.

    The fieldtype in the DB is "float", right?  Your variable in your ASP ... is that Single?  double?  Either of those should do fine.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now