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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-10-15 : 05:51:17
|
Both the following select and set return correct values heredeclare @Value decimal(20, 10) = 87.8764566declare @ValuePrevious decimal(20, 10) = 86.48456540select ((@Value - @ValuePrevious)/@ValuePrevious) * 100 set @ValueFinal = ((@Value - @ValuePrevious) / @ValuePrevious) * 100.0print @ValueFinalI am using a cursor with the above set statementI can not see why in my cursor the set returns 0.0000000000Do you see why please? |
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2012-10-15 : 06:00:19
|
arki, you have to share your cursor code, as its hard to guess, whats actually missing ?--------------------------http://connectsql.blogspot.com/ |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-15 : 22:31:13
|
quote: Originally posted by arkiboys Both the following select and set return correct values heredeclare @Value decimal(20, 10) = 87.8764566declare @ValuePrevious decimal(20, 10) = 86.48456540select ((@Value - @ValuePrevious)/@ValuePrevious) * 100 set @ValueFinal = ((@Value - @ValuePrevious) / @ValuePrevious) * 100.0print @ValueFinalI am using a cursor with the above set statementI can not see why in my cursor the set returns 0.0000000000Do you see why please?
please dont cross postdidnt you get solution here?http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=179760------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-10-16 : 00:35:03
|
Solved by not using a cursor.Thanks |
 |
|
|
|
|