Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hasanali00
Posting Yak Master
207 Posts |
Posted - 2005-10-05 : 08:29:39
|
| I want a table field to store values in KilogramsSo when I enter "1", this would mean to me that this is 1 kilogram.Similarly, I want to be able to enter values in grams. So if I want to enter 100 grams, I would have to enter 0.100Which data type do I need for this type of column???Currently, I am using Decimal (Percision=18, Scale=2)But when I enter 0.100 (100 grams), it turns to 0.1And when I enter 0.10 (10 grams), it again turns to 0.1So any idea whats the best data type to use for this type of enteries.regards |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-10-05 : 08:32:28
|
this is the correct type.traling zeros are a front end format problem not db's.Go with the flow & have fun! Else fight the flow |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-10-05 : 08:34:36
|
That is because 100 grams is 0.100 KG and 10 Grams is 0.010 KGand I reckon you should use DECIMAL(18, 3) seeing as there are 1000 grams in a KGDuane. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-05 : 09:16:05
|
| >> reckon you should use DECIMAL(18, 3) seeing as there are 1000 grams in a KGYesYou should not worry about the data formation in SQL Server0.1 is equivalent to 0.10 or 0.100 or 0.1000 etcMadhivananFailing to plan is Planning to fail |
 |
|
|
hasanali00
Posting Yak Master
207 Posts |
Posted - 2005-10-05 : 09:33:52
|
quote: Originally posted by ditch That is because 100 grams is 0.100 KG and 10 Grams is 0.010 KGand I reckon you should use DECIMAL(18, 3) seeing as there are 1000 grams in a KGDuane. 
Thanks for making me realise i was entering wrong data |
 |
|
|
|
|
|