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 |
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2008-07-22 : 06:00:03
|
| ALTER procedure [dbo].[Akadmix_InsertStudentMarks]@Marks int,@EDID int,@STUDID int,@OUT varchar(500) outasdeclare @Mx int,@Mn int,@Er int,@Mp floatbeginselect @Mx = MaxMarks,@Mn = MinMarks from Tbl_RelationExaminationDetails where ExaminationDetailID = @EDIDif (@Marks>@Mx)beginset @OUT = 'You cannot give more than'+@Mxendelsebeginif (@Marks < 0)beginset @OUT = 'Please Enter A Valid Value'endelsebeginif (@Marks < @Mn)beginset @Er = 0endelsebeginset @Er = 1endset @Mp = (@Marks/@Mx)*100 here though i am getting @Marks value as 18 and @Mx value as 50, i am getting 0 to @Mp. why?please help me on thisOne can never consent to creep,when one feels an impulse to soarRAMMOHAN |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2008-07-22 : 06:09:01
|
| I think maybe because your datatypes are int.You please see the resultset of this this examples you will understand better.declare @Marks intset @Marks=90select @marks/100select @marks/100.0 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-22 : 06:53:04
|
| thats because of implicit conversion. try like this:-set @Mp = (@Marks*100.0/@Mx) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-22 : 07:14:05
|
| http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspxMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|