July 21, 2011 at 4:09 pm
I am creating a derived column with the following code:
(DT_NUMERIC,18,3)(DER_Channel == "M" ? ((DAYS_SUPPLY / 30) > 1 ? (DAYS_SUPPLY / 30) : 1) : 1)
Everything works well except the result of the derived column is being rounded. The results are all like this:
1.000
1.000
3.000
2.000
2.000
Instead of:
.899
1.222
3.444
2.253
1.998
The field the derived column is being put into is Numeric(18,3).
I created a data viewer and the derived column is being rounded before being put into the database.
July 21, 2011 at 4:25 pm
I just found the issue. Apparently if you divide an integer by an integer the result is an integer. Here is a good explanation and fix:
http://social.msdn.microsoft.com/Forums/en/transactsql/thread/f608a688-0f48-4e81-b183-57e8dfaec641
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy