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 |
paritosh
Starting Member
42 Posts |
Posted - 2012-01-18 : 04:39:15
|
i have a problem :-when divided two numbersselect 15/10answer is 1but i want exact answer pls give answerthanks in advance |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-18 : 04:44:11
|
select 15/10.0 No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2012-01-18 : 04:50:50
|
webfred is right but you might want to know the reason why.....if you divide 2 integer values then you use integer division. So to get the answer you want then you use FLOAT or DECIMAL/NUMERIC types which result in non integer division.so if you wanted to divide 2 integers from variables or column values you need to CAST or CONVERT one of the values to a FLOAT or DECIMAL.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
|
|
|
|
|