December 10, 2003 at 10:28 pm
hi every one,
I am new in database programming with sqlserver 2000. I am confused to handle data types wisely in sqlserver2000.For instance
decimal: Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1
numeric: Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1
float: Floating precision number data from -1.79E + 308 through 1.79E + 308
real: Floating precision number data from -3.40E + 38 through 3.40E + 38
If the precision of decimal and numeric, are same then what is the necessity of having same data type in different name OR there exists some reasons behind that.
and If i always use float data type insteed of real with small scale is there any problem here?
Can you help me on that?
..Better Than Before...
December 11, 2003 at 10:13 am
For smaller scale values, I'm not sure it matters which you choose. I use numeric most of the time.
Steve Jones
http://www.sqlservercentral.com/columnists/sjones
The Best of SQL Server Central.com 2002 - http://www.sqlservercentral.com/bestof/
December 11, 2003 at 1:41 pm
The only reason I can imagine why you should use float or real is when you deal with very large numbers like in astronomy.
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
December 11, 2003 at 4:03 pm
Numeric(9,2) only uses 5 bytes, gives you two places past the decimal, say for cents. Good choice for storing bank account or credit card balances; or call center (time) statistics. I also store SMALLdatetime to save space, instead of datetime.
Jules
[font="Courier New"]ZenDada[/font]
December 12, 2003 at 2:16 am
AFAIK, all banking calculations are done with at least five decimal places.
There are strict rules on how to do calculations, roundings, storing...
In case of uncertainty I would always look this rules up whether you must comply with them.
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
December 12, 2003 at 8:45 am
Good point, Frank! I only need enough accuracy to report on call center stats, so I don't need the accuracy of a larger data type in my report level tables. Your business requirements should dictate the data types that you choose!
Jules
[font="Courier New"]ZenDada[/font]
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply