473,621 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RESULT IN FLOAT

HI,
I WANT THIS TO PRODUCE EXACT RESULT. (IN SQL SERVER)

SELECT (23 / 233) * 100

THE ANSWER SHOULD COME 9.871244635 OR 9.87
BUT IT RETURNS 0.

I WANT THE PERCENTAGE.

HOW TO HANDLE THIS KIND OF PROBLEM.
IS THERE ANY SET COMMAND FOR IT?
THANKS
T.S.NEGI
ti********@mind-infotech.com
Jul 20 '05 #1
1 1913
[posted and mailed, please reply in news]

T.S.Negi (ti********@min d-infotech.com) writes:
I WANT THIS TO PRODUCE EXACT RESULT. (IN SQL SERVER)

SELECT (23 / 233) * 100

THE ANSWER SHOULD COME 9.871244635 OR 9.87
BUT IT RETURNS 0.


This because in T-SQL, as in several other programming languages, /
yields integer division if both numbers are integer. The simplest
way is to say (1.0*23/233) * 100. In this way you get a floating-
point number.


--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5874
by: Michael Allen | last post by:
Hi all you Java 2D gurus out there. I wonder if you might be able to help me. I've been dipping my toe into the world of Gaussian blurring and with the help of a few articles and some bashing my head against the screen, I've managed to get it to work... sort of. Right now, though, when I make multiple passes with my bluring ConvolveOp objects, I get progressively more and more black border around the image I am blurring. You can see...
1
1565
by: Matthias Kaeppler | last post by:
Hello, this is related to another post by me, which sort went down, so I thought I'd make a new thread. My problem is, I want to display file sizes in the format X.YZ (two digits behind the dot). I use a stringstream to do the formatting: Here's my attempt to create a string holding file sizes this way: Glib::ustring FileBrowser::get_file_size( const boostfs::path& path )
15
5212
by: dkultasev | last post by:
I mean, when I am trying to get result of 1/3 (or smf) it returns 0.33333333334 or something. I understand that result can not be 100% right, but it is it possibly to get more accuracy ? Sincerely, sidukas
3
2193
by: Eric Davies | last post by:
We've implemented a 5D box data type and have implemented both RTree and GiST access methods under PostgresSQL 7.4 and PostgresSQL 7.4.1. The 5D box internally looks like: struct Box5D{ float minBounds; float maxBounds; }; and so takes up 40 bytes and is of fixed length. The GiST access methods are basically a generalization of the 2D box indexing access methods from Refraction Research's PostGIS.
5
5357
by: Vedran Furač | last post by:
I think that this results must be the same: In : math.atan2(-0.0,-1) Out: -3.1415926535897931 In : math.atan2(-0,-1) Out: 3.1415926535897931 In : -0 == -0.0 Out: True
4
1349
by: Rico | last post by:
Hi Folks! I have a strange thing happening; I have a field that Counts the number of records and another field that shows the number of clients (Count(RecordID)=3 and NoOfClients=2) When I do a simple expression "Count(RecordID)/NoOfClients" the expected result should be 1.5. Instead the result I get is 1. Any ideas? Thanks! Rick
6
72557
by: Johs | last post by:
I have: int a = 1; int b = 2; double c = a/b; Is it somehow possible to divide these two integers and get the result as a double 0.5? Or do they both have to be declared as doubles?
27
2433
by: csledge | last post by:
Hi, I am trying to compute a 64 bit result from 2 32 bit registers, How do I get the carry into the higher word ? Also is %lld correct ? #include<stdio.h> long long int64( long x, int y); main() { printf("%lld \n",int64(0xffffffff,1));
1
4112
by: pali | last post by:
I am running following query using Aqua Studio 4.1/AS400 DB2 select sum(amount) from table1 amount column is a decimal(11,2) I am expecting a numeric total with 2 decimal points but my result looks like this 5.8801792972E8 (float?) I tried: select sum(cast(amount as decimal(12,2)) from table1
4
8931
by: buntyindia | last post by:
Hi, I have a calculator with seven textBox to add Float numbers upto 2 decimal: I have created following function in js: function total_expenses() { // reteriving all the values from textboxes and parsing string to Float var txtBx1 = parseFloat(document.getElementById('textField01').value); var txtBx2 = parseFloat(document.getElementById('textField02').value);
0
8213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8156
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8597
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8306
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7127
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6101
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1460
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.