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 |
|
swanagetown
Starting Member
19 Posts |
Posted - 2005-04-04 : 08:50:02
|
| Hi,I can't understand why this doesn't work:CREATE PROCEDURE LTV(@Loan Int, @PropVal Int)ASDeclare @LTV decimalset @LTV = CONVERT(decimal, @Loan) / CONVERT(decimal, @PropVal)SELECT *FROM TABLE1WHERE LTV >= @LTVGOThe LTV column contains date like 0.5, 0.65, 0.80 etc...It works provided the @LTV calculation is less than 0.50 but not if it's above. To test where this is going wrong I changed "WHERE LTV >= @LTV" to "WHERE LTV >= 0.79" and it worked fine, just returned the 0.80 data. Why doesn't it like "set @LTV = CONVERT(decimal, @Loan) / CONVERT(decimal, @PropVal)"? |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-04-04 : 08:54:27
|
| You're taking the values in as INTs, so you will lose any fractional parts.Declare them as decimals in the procedure declaration.-------Moo. :) |
 |
|
|
swanagetown
Starting Member
19 Posts |
Posted - 2005-04-04 : 09:44:17
|
| Thanks.That work nicely :) |
 |
|
|
|
|
|