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 |
malachi151
Posting Yak Master
152 Posts |
Posted - 2012-01-11 : 11:11:26
|
I'm considering making a change from using integers(of various sizes) to decimal(X,0) for numbers that are used mathematically. This is to avoid having to CAST these values from an integer to perform math, and this is to avoid people making mistakes when using the data due to not knowing they need to CAST it or just accidentally forgetting to, etc.So, are there reasons not to do this, and are they compelling enough to not do it?Thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-11 : 11:17:14
|
if you dont deal with actual decimal data at all, whats the intention behind doing explicitly CASTs in your query?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
malachi151
Posting Yak Master
152 Posts |
Posted - 2012-01-11 : 11:30:02
|
Division using whole numbers, which includes stuff like AVG() and STDEV(). We do a lot of that, stuff like population density or an average of some set of counts, etc. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-11 : 11:45:11
|
for that just do num*1.0/Denom and it will get converted to decimal------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|