Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #555
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!f20g2000yqm.googlegroups.com!not-for-mail |
|---|---|
| From | BobRoyAce <broy@omegasoftwareinc.com> |
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Proper way to get decimal results from arithmetic with integers and decimals |
| Date | Wed, 20 Jul 2011 21:36:01 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 15 |
| Message-ID | <ea0bbf58-8d97-40f0-aa30-efbb667237f4@f20g2000yqm.googlegroups.com> (permalink) |
| NNTP-Posting-Host | 71.233.137.124 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1311222961 2001 127.0.0.1 (21 Jul 2011 04:36:01 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Thu, 21 Jul 2011 04:36:01 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | f20g2000yqm.googlegroups.com; posting-host=71.233.137.124; posting-account=r5en3QoAAAAe1xXGPLgZeWvDc3VNF-dB |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | HUALESNKRC |
| X-HTTP-UserAgent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0,gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:555 |
Show key headers only | View raw
Let's say that I have a table with two fields: InfPctField and DecimalField, where the first is of type INT and the latter is DECIMAL(16,2). When I write a query as... SELECT DecimalField * IntPctField / 100. AS TheAnswer TheAnswer comes back as ZERO followed by decimals, with all decimal digits ZEROs (e.g. 0.00000). What is the correct syntax to get back nonzero values? For example, when DecimalField is 1200.00 and IntPctField is 30, I should get 360.00.
Back to comp.databases.ms-sqlserver | Previous | Next — Next in thread | Find similar
Proper way to get decimal results from arithmetic with integers and decimals BobRoyAce <broy@omegasoftwareinc.com> - 2011-07-20 21:36 -0700
Re: Proper way to get decimal results from arithmetic with integers and decimals Henk van den Berg <me@myplace.net> - 2011-07-21 09:23 +0200
Re: Proper way to get decimal results from arithmetic with integers and decimals BobRoyAce <broy@omegasoftwareinc.com> - 2011-07-22 00:08 -0700
csiph-web