Nesting CONVERT(DECIMAL)

SUM(CONVERT(DECIMAL(12,2),CONVERT(DECIMAL(12,2),DATEDIFF(mi,StartTime,FinishTime))/60) - ISNULL(Breaks,0))
From the query above, I had to nest Convert decimal twice before getting the result. What is the logic behind this sort of query? I got the result I wanted but I want to equally know the reason for having decimals repeated the way I just did.
Thank you.
Zionlite

Hi Yookos/Zionlite, It looks like Himanshu explained as shown below, the third one. Am not getting what you are trying..Please eloborate.
>>>SELECT
CONVERT(DECIMAL(12,2),DATEDIFF(mi,GETDATE()-3,GETDATE()))
-- 4320.00
SELECT
CONVERT(DECIMAL(12,2),DATEDIFF(mi,GETDATE()-3,GETDATE()))
/60
--72.000000
SELECT
CONVERT(DECIMAL(12,2),CONVERT(DECIMAL(12,2),DATEDIFF(mi,GETDATE()-3,GETDATE()))
/60)
--72.00

Similar Messages

  • How to convert decimal notation to comma notation

    Hi Folks,
    I have an issue in converting decimal notation to comma notation for France.
    I have changed the decimal notation in SU01 from 123.4 to 123,4 but when i run some custom program written by me it is extracting output as 123.4 than 123,4.
    So i want to have the output of report to conver all numerical values(from decimal format to comma format) i.e., 123,4 format from the 123.4 format.
    Please help me in fixing this issue
    Edited by: Nishanth Kumar Reddy Chenchu on Apr 24, 2008 1:16 PM

    Hi Nishant,
    U can use the statement WRITE TO. This will write the data as per the user settings. When ever user changes his settings like decimal notations then this statement will write the data as per the current settings of the user.
    DATA: l_amount1 TYPE wrbtr VALUE '123.45',
              l_amount(16) TYPE c.
    WRITE:/1 l_amount1.
    WRITE l_amount1 TO l_amount.
    WRITE:/1 l_amount.
    Just copy paste above code in a sample program. First execute this program and note the output. Then change the user settings for decimal notations and log of from SAP(Because user settings will become active only after fresh login). Now execute ur report and see the difference. In this way u no need to change the program when ever user changes his settings.
    This thing not pnly applies for amount but also for date, time Quantity fields
    Thanks,
    Vinod

  • How to convert decimal numbers to Hours and minutes

    Hi,
    I am using SSRS 2005. I want to convert decimal numbers to Hours and minutes.
    Say suppose, I am adding daily work hours and minutes and the total is 208.63.
    Here 208 hrs and 63 minutes. How to convert this to 209 hrs 03 minutes in SSRS.
    Any In-built function is there? or how to do using custom code?
    Appreciate your help.
    Regards,
    Bala

    suppose if field name is TotalDailyHours you can do it as below
    =CStr(Cint(Floor(val(Fields!TotalDailyHours.Value)) + ((val(Fields!TotalDailyHours.Value)-Floor(val(Fields!TotalDailyHours.Value)))*100)/60)) + ":" +
    Right("00" +Cstr(Cint(((val(Fields!TotalDailyHours.Value)-Floor(val(Fields!TotalDailyHours.Value)))*100) Mod 60)),2)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Hi I would like to know if you can convert decimal to binary using actionscript 3.0?

    Hi I would like to know if you can convert decimal to binary using actionscript 3.0?

    Hi thanks for the response Ive tried to implement the code as you stated but it is not outputting please if you could check the following code and let me know where Ive gone wrong that would be much appreciated Thanks!.
    miles_txt.addEventListener(KeyboardEvent.KEY_DOWN,convertKilometres);
    miles_txt.restrict ="0-9";
    function convertKilometres (k:KeyboardEvent):void {
    var miles:Number;
    var kilometres:Number;
    if (k.keyCode == Keyboard.ENTER){
    miles=Number(miles_txt.text);
    kilometres=miles* 1.609344;
    kilometres_txt.text = kilometres.toPrecision(2);
    kilometreConvert_txt.addEventListener(KeyboardEvent.KEY_DOWN,convertKiloToMile);
    kilometreConvert_txt.restrict = "0-9";
    function convertKiloToMile(k:KeyboardEvent):void{
    var kilometreConvert:Number;
    var milesAnswer:Number;
    if (k.keyCode==Keyboard.ENTER) {
    kilometreConvert=Number(kilometreConvert_txt.text);
    milesAnswer=kilometreConvert* 0.621371192;
    milesAnswer_txt.text = milesAnswer.toPrecision(2);
    binary_txt.addEventListener(KeyboardEvent.KEY_DOWN, checkEnterKey2);
    function checkEnterKey2(e:KeyboardEvent):void{
    if(binary_txt.text != '' && e.keyCode == Keyboard.ENTER){
    decimal_txt.text=binaryToDecimal(binary_txt.text).toString();
    function binaryToDecimal(s:String):Number{
    var n:Number = 0
    for(var i:int=0;i<s.length;i++){
    n+=Number(s.substr(i,1))<<(s.length-1-i)
    return n;
    function decimalToBinary(n:Number):String{
    return n.toString(2);
    return_btn.addEventListener(MouseEvent.CLICK, goBackToCalculator);
    function goBackToCalculator(e:Event):void
    mybuttonSound.play();
    gotoAndStop("Calculator");
    clear_btn.addEventListener(MouseEvent.CLICK,clearField);
    function clearField(e:MouseEvent):void{
      mybuttonSound.play();
      miles_txt.text ="";
      kilometres_txt.text ="";
      milesAnswer_txt.text ="";
      kilometreConvert_txt.text ="";
      binary_txt.text ="";
      decimal_txt.text ="";

  • Convert decimal to char type

    Hi all,
    How to convert decimal type length 3(e.g:25.0) to char type.......
    Thanks in advance

    hi,
       data : var_dec type p decimals 3,
              var_char(10).   
    <b>move var_dec to var_char.</b>
    else use FM
          CALL FUNCTION <b>'CEVA_CONVERT_FLOAT_TO_CHAR'</b>
               EXPORTING
                    FLOAT_IMP  = P_ORIGEN
                    FORMAT_IMP = CAMPO_FLOAT
               IMPORTING
                    CHAR_EXP   = C_DESTINO.
    Regards,
    Santosh

  • Convert decimal into integer

    Hello i think that's a simple question. I've to convert a decimal number (such as 0,1 ) into an integer number such as 0.
    What should i do? i tried with functions >> numeric >> conversions >> to long integers but i saw  it has only integers as input. 

    Not 100 percent sure what you wanted, so I've provided 3 alternatives.
    Mathematically rounds the number to the nearest whole value (integer)
    Divides the number by 1 (can be any constant, but for your case, 1 is used) and returns the quotient and remainder.  The quotient is the number as if it was rounded down to the nearest whole value (integer)
    Blindly converts your single precision (I assume this is your data type) to a long integer.  This will also get rid of the decimal place.
    I hope this helps.
    P.S.  Examples 1 & 2 use DBL precision values - these are interchangeable with SGL precision values, assuming you only need 1dp precision.
    Message Edited by James Mamakos on 05-11-2009 10:53 AM
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    Nearest integer.JPG ‏5 KB
    Nearest multiple of 1.JPG ‏6 KB
    Blind conversion.JPG ‏7 KB

  • Converting DECIMAL field in R/3 into CHAR field on BW

    Hi all,
       We have a field in R/3 which is defined as :
          Data Type : Decimal
          Length      : 6
          Decimal Places : 2
         I want to receive it into CHAR field on BW side.
         How could I convert it, please. What should be length of this CHAR field in BW?
    Thanks in advance.

    Hi Venkat,
    Create a character infoobject of length 18. Include the infoobject in your data target and map the key figure value to the character infoobject by writting the following update routine for the character infoobject.
    Result = comm_structure-xxxxxx (xxxxxx = key figure infoobject you want to map for example say comm_structure-net_price if key figure is 0net_price)
    Please assign points if it helps,
    Neelima
    Message was edited by:
            Neelima Ravipati

  • Convert decimal to binary

    hi all!
    I want to convert from message box witch is in ascii (decimal) to a signal in binary... can anyone help me?
    thanks in advance

    hello,
    I've made this example. It's strange. But in the moment it's my only idea.
    it output's two different ways. Because I didn't understand exactly what you need.
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL
    Attachments:
    Convert.vi ‏10 KB

  • Convert decimal to binary with a fixed length

    Hi, I need to write a program that converts a decimal number to binary with a fixed length (say 5), for example, decimal digit "0" -> binary number "00000". I try Integer.toBinaryString(), but it will just cut off the leading bits, so I wonder how to let the conversion happen, anyone can help me with that, thanks in advance.
    mckie

    Daiyue_Weng wrote:
    Hi, I need to write a program that converts a decimal number to binary with a fixed length (say 5), for example, decimal digit "0" -> binary number "00000". I try Integer.toBinaryString(), but it will just cut off the leading bits, so I wonder how to let the conversion happen, anyone can help me with that, thanks in advance.
    mckieWhat do you expect it to do? When you limit yourself to 5 digits binary you can only represent 0 to 63 and you will loose anything not in those 5 digits.

  • Converting decimal to hex

    Does any one have any code snippet to do this in Java ?
    one of the applications that i am building has the need to convert an incoming decimal value from a backend system to hex and take the last 2 fields of the hex value for some comparison checking.
    All help is deeply appreciated ..
    thanks
    Rox

    one of the applications that i am building has the
    need to convert an incoming decimal value from a
    backend system to hex and take the last 2 fields of
    the hex value for some comparison checking.In an int representation of a number each hex digit will occupy 4 bits, so
    int i = ....; // decimal number
    int h1 = i & 0xf; // first hex digit from the right
    int h2 = (i>>>4) & 0xf; // second hex digit

  • Convert decimal to comp-3 format

    how do i convert a decimal value i.e. 01 to comp-3 format i.e. 001C?

    Hi Swapna,
    Please go to SU01 --> Enter user id --> display --> Anc click on default tab and check the decimal notation.
    Declare one field to currency type and then try
    Use FM BKK_AMOUNT_CONV_TO_INTERN_MAIN.
    you can check by changing the values in su01.but remember your change reflect only when you logoff SAP and again login.so once logoff is needed.
    regards,
    Ranveer.

  • Linq to oracle entities - convert decimal to string

    hi ,
    Im using entityframework beta for oracle
    I need compare string to a decimal column in my linq to entities query so i need convert number column to varchar, but .toString is not supported nor Convert.ToString nor SQLFunction.ToVarchar(or something like that) so how can i achieve this? should i import db function or there is some other (easier) way?
    Thx for answer

    Hi,
    I solved it by importing to_char builtin oracle function to my model:
    in edmx file put this (to section where your other procedures/functions are ) (change schema attribute to yours):
    <Function Name="to_char" ReturnType="varchar2" Aggregate="false" BuiltIn="true" NiladicFunction="false" IsComposable="true" ParameterTypeSemantics="AllowImplicitConversion" StoreFunctionName="to_char" Schema="TOPASFO_DEMO">
    <Parameter Name="value" Type="number" Mode="In" />
    </Function>
    And make partial class of your entities class and put there this:
    [EdmFunction("Store", "to_char")]
    public string to_char(decimal value)
    // don’t need to implement the function
    throw new ApplicationException();
    And you can call it just like your other imported functions/procedures.

  • Converting decimal to String

    Hello,
    I want to handle a number stored in a MySQL database as a string. The database type is decimal(5,2). If the decimal portion is .00, then it only returns .0 (1 zero). Can someone help me out?
    Thanks!

    In our upcoming 10.1.3 (see preview) there is support for providing converters on the direct mapping. This will allow you to specify a specific converter for one mapping or share it across mappings with these same requirements.
    In 9.0.4 and earlier I would recommend using the TypeConversionMapping. This allows you to specify that you want your numeric values stored as strings. To control the format you can provide your own ConversionManager at system start-up (ConversionManager.setDefaultManager(new MyConversionManager()) - refer to docs and Java Docs for specific details. The only limitation is that the conversion will be the same for all Numeric-&gt;String conversions when writing to the database, instead of per mapping. This is fine for most scenarios I have seen.
    There are some additional solutions I have seen used if that does not meet your needs:
    - Use your own wrapper class for the numeric value. This wrapper would have a toString() that writes the values out as you expect. Populating it can be done in either the method accessor set method or again with a custom conversion manager.
    - In your MySQLDatabasePlatform (assuming you wrote one) you can customize how values are written. This would also limit you one format for all similar types.
    I recommend the TypeConversionMapping with the custom ConversionManager and then when you migrate to 10.1.3 you can switch to the more flexible converters on mappings.
    How-to on custom conversion: http://www.oracle.com/technology/products/ias/toplink/technical/tips/customconversion/index.html
    Doug

  • Convert decimal to currency

    Hi everyone how &#305; convert to data decimal to currency?
    thkns for your help?

    Hi onyedili,
    look this SAP help:
    REPORT demo_list_write_currency LINE-SIZE 40.
    DATA: num1 TYPE p DECIMALS 4 VALUE '12.3456',
    num2 TYPE p DECIMALS 0 VALUE '123456'.
    SET COUNTRY 'US'.
    WRITE: 'USD', num1 CURRENCY 'USD', num2 CURRENCY 'USD',
    / 'BEF', num1 CURRENCY 'BEF', num2 CURRENCY 'BEF',
    / 'KUD', num1 CURRENCY 'KUD', num2 CURRENCY 'KUD'.
    Regards,
    Allan Cristian

  • Oracle 10g - Convert decimal to HH:MM

    Hi
    How can I convert a decimal to Hours:Minutes format eg. 2.75 to 2 Hours and 45 Minutes
    Thanks in advance

    or perhaps
    SQL> SELECT TRUNC(2.75) || 'hrs:' ||
           SUBSTR(numtodsinterval(2.75, 'HOUR'), 15,2) || 'mins:' ||
           SUBSTR(numtodsinterval(2.75, 'HOUR'), 18,2) || 'secs' FROM dual
    TRUNC(2.75)||'HRS:
    2hrs:45mins:00secs
    1 row selected.
    SQL> SELECT TRUNC(129.657) || 'hrs:' ||
           SUBSTR(numtodsinterval(129.657, 'HOUR'), 15,2) || 'mins:' ||
           SUBSTR(numtodsinterval(129.657, 'HOUR'), 18,2) || 'secs' FROM dual
    TRUNC(129.657)||'HRS
    129hrs:39mins:25secs
    1 row selected.Or maybe better
    SQL> SELECT TRUNC(2.75) || 'hrs:' ||
           extract (minute from numtodsinterval(2.75, 'HOUR' )) || 'mins:' ||
           extract (second from numtodsinterval(2.75, 'HOUR')) || 'secs'
      FROM dual
    TRUNC(2.75)||'HRS:'||EXTRACT(MINUTEFROMNUMTODSINTERVAL(2.75,'HOUR'))||'MINS:'||E
    2hrs:45mins:0secs                                                              
    1 row selected.
    SQL> SELECT TRUNC(129.657) || 'hrs:' ||
           extract (minute from numtodsinterval(129.657, 'HOUR' )) || 'mins:' ||
           extract (second from numtodsinterval(129.657, 'HOUR')) || 'secs'
      FROM dual
    TRUNC(129.657)||'HRS:'||EXTRACT(MINUTEFROMNUMTODSINTERVAL(129.657,'HOUR'))||'MIN
    129hrs:39mins:25,2secs                                                         
    1 row selected.Regards
    Peter
    Edited by: Peter on Mar 2, 2009 12:52 AM

Maybe you are looking for

  • Cannot open PDF files on Mac

    I cannot open PDFs on my Mac but can open the same files on my PC.  When I create a PDF from the computer and when I send it to our office printer as a scan-PDF, I cannot open either.  Have downloaded Adobe Acrobat, etc., and still waiting for a resp

  • T410 system restore interupted, Win 7

    HI, My daughter's boyfriend was having a problem with all his word docs on his T410 so he started a "System restore" from the Windows boot manager without backing up anything (I know, big red WARNING sign) and then immediately realized his mistake an

  • Maintain Subscreen for Coding Block

    Dear Guys I have a requirement to create a subscreen for a FI transaction. I know that this can be done using OXK1. I have already created a subscreen. But I want to know that how can I link that subscreen with a particular Transaction. e.g I have ma

  • My iPod does not start, i dont know why !!!

    Hi first. I'm glad to be here. My iPod 60GB Video, does not start. I have try many methods to start it but its not starting. I was changin themes in iPod and its turned off, and doesn't start anytime. Have anyone any answer ( answer which can help me

  • Traveling across time zones and calendar events

    I am going to Europe and want to know if I put my flights into my iOS calendar now using European local flight time will my calendar adjust for the time zone when I am there? I live in MST. In other words if I enter a 4:00PM FLIGHT now in MST, when I