Here's what I get:
declare @decimalField decimal(12,5)
declare @intpctfield int
set @decimalfield=1200.00
set @intpctfield=30
SELECT @DecimalField * @IntPctField / 100. AS TheAnswer
TheAnswer
-------------
360.000000000
So can you post your query that yields the results you mention? This may
shed some light on it.
Best,
Henk
BobRoyAce schreef op 21-07-2011 06:36:
Quote:
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.
|