SQLServerCentral.com / SQL Server 2005 Integration Services / SQL Server 2005 / Get the fractional part of a decimal with SSIS Expressions / Latest PostsInstantForum.NET v99.99.99SQLServerCentral.comhttp://www.sqlservercentral.com/Forums/notifications@sqlservercentral.comFri, 02 Dec 2016 22:24:28 GMT20RE: Get the fractional part of a decimal with SSIS Expressionshttp://www.sqlservercentral.com/Forums/Topic1421649-148-1.aspxThanks Phil,In my case, this will always be a positive decimal. But you made a good point.Tue, 19 Feb 2013 09:07:03 GMTrburkoRE: Get the fractional part of a decimal with SSIS Expressionshttp://www.sqlservercentral.com/Forums/Topic1421649-148-1.aspxAwesome! That works! I was already using Floor to pull out the integer part of the decimal. It didn't occur to me to use floor to subtract the integer from the decimal to get the fractional part. The only part I had to add was a cast to decimal to get the result; in my case:(DT_DECIMAL,2)((1.2 - FLOOR(1.2)) * 100))Thanks!Tue, 19 Feb 2013 09:05:54 GMTrburkoRE: Get the fractional part of a decimal with SSIS Expressionshttp://www.sqlservercentral.com/Forums/Topic1421649-148-1.aspx[quote][b]Daniel Bowlin (2/19/2013)[/b][hr]How about1.2 - FLOOR(1.2)Floor returns the largest integer that is less than or equal to the numeric expression[/quote]Not true for negatives. Try this:[code="sql"]select -11.2 - floor(-11.2)[/code]But stick to positive numbers, or use ABS() too and it should work.Tue, 19 Feb 2013 08:36:17 GMTPhil ParkinRE: Get the fractional part of a decimal with SSIS Expressionshttp://www.sqlservercentral.com/Forums/Topic1421649-148-1.aspxHow about1.2 - FLOOR(1.2)Floor returns the largest integer that is less than or equal to the numeric expressionTue, 19 Feb 2013 08:20:53 GMTDaniel BowlinGet the fractional part of a decimal with SSIS Expressionshttp://www.sqlservercentral.com/Forums/Topic1421649-148-1.aspxThis shouldn't be too hard but I'm still having trouble getting the fractional part of a decimal number using SSIS expressions without jumping through a lot of hoops. I found this simple method to get the fractional part using T-SQL.[code="sql"]Select 1.2 % 1 [/code]So of course I thought, "SSIS expressions have a modulo operator, I'll just use that." But it doesn't work. It looks like you can only use integers when using the modulo operator in an expression.Short of converting the decimal to a string, finding the decimal position using Findstring, then digging out the fractional part using a substring function, what is the best option for getting the fractional part of a decimal number?Tue, 19 Feb 2013 07:40:41 GMTrburko