OK, just not my night with decimal values.

Trying to store distances (for throwing and jumping events), which are
measured in feet and inches.  In order to maintain proper sort order, I
decided to convert feet and inches (with fractions of an inch as decimal
value) to inches with fractions of an inch as decimal values.

Again, database is SQL Server 2008, and I'm using cfqueryparam.  Data type
for the column in question is decimal(18, 4), and I'm using CF_SQL_DECIMAL
as the cfsqltype value.  I can see in the debug output that the decimal
portion of the value is part of the value to be inserted, for instance,
825.25, but looking at the database table, the stored value is  825.0000
 Here's the debug output for that query:

*insertResult* (Datasource=track, Time=2ms, Records=1) in
C:\inetpub\wwwroot\track\enter_results.cfm @ 21:59:59.059

                                        INSERT INTO             
tblEventResults(eventid, athleteid, time, distance,
competition)
                                        VALUES                  (?,
                                                                         ?,
                                                                         ?,
                                                                         ?,
                                                                         ?)
                                

Query Parameter Value(s) -
Parameter #1(CF_SQL_INTEGER) = 1
Parameter #2(CF_SQL_INTEGER) = 1
Parameter #3(CF_SQL_TIMESTAMP) =
Parameter #4(CF_SQL_DECIMAL) = 825.25
Parameter #5(CF_SQL_BIT) = NO

Should I be using a different precision value for the decimal datatype?  Or
am I just doing something idiotic?

Thanks,

Pete

On Sat, Feb 26, 2011 at 4:59 PM, Pete Ruckelshaus <[email protected]>wrote:

> Hey, that did it!  Thanks!
>
> Pete
>
>
> On Sat, Feb 26, 2011 at 4:43 PM, Charlie Griefer <
> [email protected]> wrote:
>
>>
>> Hi Pete:
>>
>> Have you tried cf_sql_timestamp as the cfsqltype (as opposed to
>> cf_sql_time)?
>> --
>> Charlie Griefer
>> http://charlie.griefer.com
>>
>> I have failed as much as I have succeeded. But I love my life. I love my
>> wife. And I wish you my kind of success.
>> On Saturday, February 26, 2011 at 2:33 PM, Pete Ruckelshaus wrote:
>> >
>> > I'm building an app for keeping track of high school track meet results
>> > using CF9 and MS SQL Server 2008. I am using the "time(7)" data type in
>> the
>> > database, and when doing the insert query, I'm using <cfqueryparam> with
>> a
>> > sqltype of cf_sql_time. However, when entering a time value of, for
>> > example, "00:01:22.05", the value that actually gets inserted drops the
>> > decimal part of the seconds. When I do the insert query without using
>> > <cfqueryparam>, it works fine. I prefer using cfqueryparam for obvious
>> > reasons and am always hesitant to not use it, so is there a way to get
>> it to
>> > work and still have it retain the decimal portion of the second?
>> >
>> > Thanks,
>> >
>> > Pete
>> >
>> >
>> >
>>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342602
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to