I have few form fields where user can enter whole
numbers, decimal
numbers and both types can be positive or negative. In other words they can enter something like this:
1 or 0.9 or 5.6745 or -10 or -0.9 or -10.5435
I'm wondering what I should use in my cfqueryparam
on cfsqltype? I tried decimal but looks like that is not supported in ColdFusion 9. Is there any other option or I should use varchar
?
Use the option that matches the column in your database. By selecting the correct value, Coldfusion will try to validate and format the value before it is sent off to the database driver.
With fix precision types
cf_sql_numeric
andcf_sql_decimal
you need to also specify the scale (number of decimal places) your column accepts. By default the scale is 0, and will only store an integer number. Once again check your database for the scale.For non precision types such as
cf_sql_float
no scale should be specified and the full value is sent off to the database.Full list of data types can be found in the Adobes docs.