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 |
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-14 : 05:49:19
|
| Im comparing values. if i add the values which is numeric or monetary in the column and if it is greater than zero it will insert to a table, but the datatype of my column([Day 30 AMT] etc. is char. i want to implement like these like these because it cant return a result if i query..FROM tbl1 a LEFT OUTER JOIN tb2 bON a.ID = b.IDWHERE b.ID IS NULL ANDa.[Day 30 AMT] + a.[Day 60 AMT] + a.[Day 90 AMT] + a.[Day 120 AMT] + a.[Day 150 AMT] + a.[Day 180 AMT] + a.[Day 210+ AMT]) > 0 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-14 : 05:59:23
|
If it is amount column, why is it CHAR in first place?You can cast it to numeric data type anyway but wouldn't be an efficient solution.cast(a.[Day 30 AMT] as Numeric(18,6)) + .... Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-14 : 06:03:57
|
| If possible change the datatype to DECIMAL or NUMERICMadhivananFailing to plan is Planning to fail |
 |
|
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-14 : 06:19:09
|
| what is Numeric(18,6) means? the number.. if i change the data type what should be applicable the amount is not exceed to 6 digits.. Thanks you |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-14 : 06:26:16
|
| 18,6 denotes its precision & scale. precision menas total number of digits it can hold while scale means number of digits to right of decimal point. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-14 : 06:27:05
|
| What I shown is just an example, you have to decide scale and precision based on your data and requirements.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-14 : 06:28:05
|
| is it possible if i dont put a scale? Thanks |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-14 : 06:31:54
|
| Yes, scale is optional.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-14 : 06:34:25
|
| Thanks! :) |
 |
|
|
|
|
|