| Author |
Topic |
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2009-07-13 : 09:03:21
|
| Can someone tell me why the query below doesn't return the value 5:select (10 / 100) * 50I get 0As far as I can see this should work so I assume I'm doing something stupid! |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-13 : 09:11:27
|
integer divide by integer will give you back integer so 10 / 100 will give you 0use decimalselect (10.0 / 100) * 50 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-13 : 09:15:48
|
| DECLARE @DEC1 DECIMAL(5,1)DECLARE @DEC2 DECIMAL(5,1)DECLARE @DEC3 DECIMAL(5,1)SET @DEC2 = 10SET @DEC3 = 100SELECT @DEC1 = @DEC2/@DEC3SELECT @DEC1 = @DEC1*50SELECT @DEC1-------------------------R.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-13 : 09:17:21
|
quote: Originally posted by rajdaksha DECLARE @DEC1 DECIMAL(5,1)DECLARE @DEC2 DECIMAL(5,1)DECLARE @DEC3 DECIMAL(5,1)SET @DEC2 = 10SET @DEC3 = 100SELECT @DEC1 = @DEC2/@DEC3SELECT @DEC1 = @DEC1*50SELECT @DEC1-------------------------R..
No need of chaging the datatype. Refer the linkMadhivananFailing to plan is Planning to fail |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-13 : 09:24:10
|
| here link is not open bcoz its restricted.. i missed to read-------------------------R.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-13 : 09:31:25
|
quote: Originally posted by rajdaksha here link is not open bcoz its restricted.. i missed to read-------------------------R..
I see. How can a SQL Server related blog be blocked there? MadhivananFailing to plan is Planning to fail |
 |
|
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2009-07-13 : 09:33:06
|
| Thanks for the info guys! |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-13 : 09:47:34
|
quote: Originally posted by madhivanan
quote: Originally posted by rajdaksha here link is not open bcoz its restricted.. i missed to read-------------------------R..
I see. How can a SQL Server related blog be blocked there? MadhivananFailing to plan is Planning to fail
Posted - 07/13/2009 : 09:46:39 -------------------------------------------------------------------------------- Its blog created site right..could be GE Standards...(Client Side Validation ) -------------------------R.. |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2009-07-13 : 10:56:35
|
quote: Originally posted by madhivananI see. How can a SQL Server related blog be blocked there? MadhivananFailing to plan is Planning to fail
Easy. Employers block ANYTHING that has 'blog' in it. They even block Microsoft blogs. Its called lazy network admins.http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-13 : 10:58:47
|
quote: Originally posted by DonAtWork
quote: Originally posted by madhivananI see. How can a SQL Server related blog be blocked there? MadhivananFailing to plan is Planning to fail
Easy. Employers block ANYTHING that has 'blog' in it. They even block Microsoft blogs. Its called lazy network admins.http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp
MadhivananFailing to plan is Planning to fail |
 |
|
|
|