Re: how to assigned float number to DB ?
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 24 Jun 2007 21:43:37 +0200
On Sat, 23 Jun 2007 01:38:00 -0700, guy wrote:
how can i assigned a float number with only one digit after the dot to the DB ?
i mean that i want to write this number 0.1 and not this 0.100000000 (that
what the sql does for me now..)
im using a storage procedure for this purpuse, so maybe the problem is there..
thanks !!
Hi Guy,
The only difference between 0.1 and 0.100000 is representation; their
values are exactyl equal. Since the internal representation for numeric
datatypes is different from what you see anyway, this question really
can't be answered. Whether you assign 0.1, 0.10000 or 0.2/2 to a float
variable or column, the result will always be the same.
So, if you want to STORE numbers with only one decimal place, then
Hari's answer is correct - you can't do that with float numbers, but you
can with the datatype numeric. If, on the other hand, you want to store
float numbers but REPRESENT them with one digit after the decimal place,
check out the subjects STR and CONVERT in Books Online. Note that these
functions convert a float value to a string representation, so the value
is no longer considered a number after this conversion!
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
.
- Prev by Date: Re: how to assigned float number to DB ?
- Next by Date: Re: Blinking in HScrollBar / VScrollBar
- Previous by thread: Re: how to assigned float number to DB ?
- Next by thread: Re: Blinking in HScrollBar / VScrollBar
- Index(es):
Relevant Pages
|
|