Decimal value in a query

Hi
When we try to create a query that have a calculation, the result always presented as a decimal(10,3).
Is possible to have a result as a decimal(10,4)?
for example
SELECT 0.125*0.1
the result should be 0.0125, but in query from SAP BO appears 0.013
VS

Hi Vasco
Try this .This is more dynamic .
>>
DECLARE    
            @A decimal(15,3),
            @B decimal(15,3)
SELECT      @A = 123.51,
            @B = 124.56
SELECT SUBSTRING(CONVERT(nvarchar(30),CONVERT(decimal(30,4),@A@B)),0,CHARINDEX('.',CONVERT(nvarchar(30),CONVERT(decimal(30,4),@A@B))))
            +'.0'
            + SUBSTRING(CONVERT(nvarchar(30),CONVERT(decimal(30,4),@A@B)),CHARINDEX('.',CONVERT(nvarchar(30),CONVERT(decimal(30,4),@A@B)))+1,LEN(CONVERT(nvarchar(30),CONVERT(decimal(30,4),@A@B)))-CHARINDEX('.',CONVERT(nvarchar(30),CONVERT(decimal(30,4),@A@B))))
>>
Hope this helps
Bishal

Similar Messages

  • Static Decimal value in insert query

    HI am going to insert decimal value in table but i got this error" Arithmetic overflow error converting numeric to data type numeric."
    HERE  val one is a decimal value how can do this?
    INSERT INTO TBL(CON,VAL)
    SELECT ID,'2.0' FROM TBL1

    Chino,
    SHud eb a problem with the precision value of your column. Try increasing the same. The following example shud help:
    --case 1
    declare @tab table (id decimal(3,2),name varchar(100))
    --precision=1 scale=2
    insert @tab select 51.987 , 'jk'
    select * from @tab
    Msg 8115, Level 16, State 8, Line 2
    Arithmetic overflow error converting numeric to data type numeric.
    --case 2
    declare @tab table (id decimal(4,2),name varchar(100))
    --precision=2 scale=2
    insert @tab select 51.987 , 'jk'
    select * from @tab
    Works Fine
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • SHOW DECIMAL VALUES IN QUERY

    Hi,
    I would like to show the decimal values of a calculated keyfigure when i execute the query.
    Heres whats happening:
    Base Price * Qty = XXXXX
    11*2.6=28.6
    bur when i execute the query it shows 29 as the answer, its rounding it off. How can i fix this?
    Thanks

    Use report SAP_RSADMIN_MAINTAIN and set object 'IGNORE_T006_ANDEC' to the value 'X'
    Decimals will show up right away!
    More details why this is happening in Note 866505
    cheers,
    Mantas
    Edited by: Mantas Vaisvilas on Sep 2, 2008 12:24 PM

  • Problem when Entering Decimal Values at Input Ready Query

    Hi Everyone,
    I have created Input ready query but when I am going to enter decimal values in input cell it takes as a round of value.
    Example:- If I enter 1.234 value at input cell it takes as a 1 or if I enter 1.789 value then it takes as a 2 at cell.
    The technical properties of Key Figure at Info object level is,
    Radio Button :- Decimal
    Drop Down :- FLTP (Floating Point)
    But we want to whatever value will enter at input cell, the same value will save at real time info cube level.
    Requirement :- If I enter 1.234 value at input cell it needs to take as a 1.234
    Please suggest your comments/views.
    Thanks
    Kind Regards
    Anukul

    Hi Giradkar,
    Check the setting of the UOM you are using in table 'T006' there are 2 fields that indicate how to display and how to store the values with respective UOM.
    Regards,
    Eitan.

  • Display decimal values in report

    Hi all,
    I have one question concerning the display of decimal values smaller than '1' in a report.
    In an SQL query some calculations are done and the result is displayed in a report.
    The problem is, that if the value of the result is smaller than '1' it shows for example ,8 instead of 0,8
    Does anybody know how to display decimal values normally?
    kind Regards and thanks!!
    Patrick

    Hi SWED!
    1.) Click at the name of your report region (in application builder) to edit it
    2.) Select the "report attributes" tab
    3.) Click at the column you want to format
    4.) Look for the "Column Formatting" region
    5.) Select the proper format from the "Number / Date Format" list or enter your own format like "0.0"
    I hope that will help you along.
    yours sincerely
    Florian W.

  • Rounding a decimal value to 3 digits

    I have opened a UDF and copied the value of Total (LC) column in that field. I want to round off the copied value to 2 digits.
    Below is the query written to copy the value.
    SELECT ($[$38.21.NUMBER] * $[$38.U_GST.1.11]) / 100
    Below is the query written to ROUND the value.
    SELECT ROUND(($[$38.21.NUMBER] * $[$38.U_GST.1.11]) / 100, 2)
    Thanks & Regards,

    Try: SELECT ROUND(($[$38.21.NUMBER\] * $[$38.U_GST.NUMBER\]) / 100, 3)
    However, I think it is probably not working because B1 has internal checking to make sure the decimal value follow your setting. If you setup your currency by 2 decimals, you may never get any additional decimal place.
    Thanks,
    Gordon

  • Decimal Values getting truncated

    Hi,
    In my query results, the decimal values are getting truncated.  e.g.
    0.30 + 0.44 = 0.70  (expected result = 0.74)
    0.30 + 0.45 = 0.80  (expected result = 0.75)
    0.40 + 0.48 = 0.80  (expected result = 0.78)
    What am I supposed to do to make sure that the second decimal point is not truncted.
    Thanks,

    Hi,
    I do not have any conditions.  Except that I am just using the function NODIM to get the decimal values in my report.
    I did tried using the decimal places in the Key Figure properties.
    Are there any other possibilities to solve this?
    Thanks,

  • How to check decimal value in numeric field

    Is there any way to find number of decimal digit is being used.
    999.444
    444.45
    344.23
    33.666666666666
    Query provide rusult after the decimal value.
    thanks.

    user-Keen wrote:
    Query provide rusult after the decimal value.
    thanks.
    your_col - trunc(your_col)Do you have negative numbers?
    For negative values what do you want to display?
    If just the decimal part, you could use ABS(col) - trunc(ABS(col))
    Edited by: jeneesh on Apr 4, 2013 3:29 PM

  • Sql server max function for decimal value

    dear team
    i have column which contains decimal value eg,
      QuestionMasterId  Studentid   Score
    19                         1            9.01,
    19                         2            9.02,
    19                         3            9.35,
    19                         4            8.04,
     i have to display the max score  - that student score but when i am using the following query it is returning the int value  
      DECLARE @MAX decimal
      SELECT @MAX=max(Score) from [QuestionPaperwiseScore] where QuestionMasterId=19 
      print @MAX
     select Studentid,Score,@MAX-Score as diff from [QuestionPaperwiseScore] where QuestionMasterId=19
    kindly help

    Take a look at
    BOL again. The default scale is 0. Thus it behaves like an INT.
    DECLARE @Sample TABLE
    QuestionMasterId INT ,
    Studentid INT ,
    Score DECIMAL(3, 2)
    INSERT INTO @Sample
    VALUES ( 19, 1, 9.01 ),
    ( 19, 2, 9.02 ),
    ( 19, 3, 9.35 ),
    ( 19, 4, 8.04 );
    DECLARE @MAX DECIMAL(3,2);
    SELECT @MAX = MAX(Score)
    FROM @Sample
    WHERE QuestionMasterId = 19
    SELECT @MAX;
    SELECT Studentid ,
    Score ,
    @MAX - Score AS diff
    FROM @Sample
    WHERE QuestionMasterId = 19

  • Decimal values truncated from SQL Call through Oracle ODBC

    Hi
    I'm using Oracle ODBC driver v 9.02.00.06; when I make a SQL call to query data from the Oracle ERP (PO_Lines_All), my decimal values are truncated. Instead of getting 112.25, I only get 112
    Can someone help me fix this problem?
    thanks

    The problem is commonly related to a language difference between Oracle and SQL Server.
    Try setting HS_LANGUAGE=american_america.we8mswin1252 in the intialisatuion file of HSODBC.
    Then start a new SQL*Plis session and give it a try.
    If you still have problems, set it to:
    HS_LANGUAGE=german_germany.we8mswin1252 in the

  • How do I convert an alpha character from a text string to its decimal value

    I am trying to find out the actual decimal value of a character in a string. So far the code below is as far as I got. I am able to get what I guess is a byte value.
    This is for a school assignment:
    The idea behind what I am trying to do is to design a hash function to store dictionary words into a bucket array hash table, without using the existing Hashtable.class
    so far this is what I can come up with to get some kind of value for each character in the string, however, what I am trying to get is the decimal value for each character.
    public static void main(String args[]){
         String word = "abcdefghijklmnopqrstuvwxyz";
         for (int i=0 ; i < word.length(); i++){
         System.out.print((word.substring(i,i+1)));
         System.out.print("\t : "+((word.substring(i,i+1))).getBytes());
    Thankyou for any replies.

    I'm not sure I completly understand your goal- what you mean by "decimal value", but, if you simply want to find the byte value of each character in a String, you would probably be better off using getBytes() in a way like this,
    byte [] bytes = string.getBytes();
    Then, if you need to map that to a charcter, you could use a for loop like
    for (int x = 0; x < bytes.length; x++) {
    table.put((char)bytes[x], bytes[x]);
    which assummes this bucket class of yours allows primitive data types like so (in Hashtable or HashMap, you would have to use a wrapper Object). I guess, my point reduces to, don't use substring and string search methods (like indexOf()), unless you have to because they are more expensive then just maping the array of bytes and chars, which seems to be what you are interested in doing.

  • Decimal  values for a field in ALV

    Hi,
    I created an ALV report.
    It has a field which will display the calculated value as '103,839,389'. This should be dispalyed as '103,839,389.00' with decimal value, I mean with 2 decimal places, how can this be achieved?
    Thanks,
    Kumar

    hi check this..
    use these in populating the fieldcat..
    it_fieldcat-decimalsfieldname = fieldname
    it_fieldcat-decimalstabname   = tabname
    it_fieldcat- decimals_out   = 2.
    regards,
    venkat

  • ALV report - remove of decimal values

    Hi experts,
    In my ALV report, output table having decimal values, ex:90000.50, i want to display only 90000,
    can help any one inthis.
    Thanks in advance.
    Regards
    Rams

    Hi,
    for that particular field in Field catalog..
    <ur field cat>-decimals_out = 0.
    see this sample code.
    type-pools: slis.
    DATA: begin of itab6 occurs 0,
    chk type c,
    a type p decimals 2,
    b type p decimals 2,
    c type c,
    end of itab6.
    data: ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    wa_layout TYPE slis_layout_alv.
    itab6-a = '1.12'.
    itab6-b = '2.25'.
    itab6-c = '+'.
    append itab6.
    append itab6.
    append itab6.
    append itab6.
    ls_fieldcat-fieldname = 'A'.
    ls_fieldcat-seltext_m = 'A'.
    append ls_fieldcat.
    ls_fieldcat-fieldname = 'B'.
    ls_fieldcat-seltext_m = 'B'.
    ls_fieldcat-decimals_out = 0.  "this ll do
    append ls_fieldcat.
    ls_fieldcat-fieldname = 'C'.
    ls_fieldcat-seltext_m = 'C'.
    append ls_fieldcat.
    wa_layout-box_tabname = 'ITAB6'.
    wa_layout-box_fieldname = 'CHK'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    it_fieldcat = ls_fieldcat[]
    IS_LAYOUT = wa_layout
    TABLES
    t_outtab = itab6[].
    Cheers,
    jose.

  • CHAR's value in the query but not in the report??

    Hi all,
    I loaded master data and crm transaction data from ODS to Cube. The data is in the cube but there is no value in my report when running it. EX: there are some CHARs in my report, I checked those CHARs have value in the query but it shows 'not assign' in my report when I run it. What happen?
    Thanks.
    J.

    Please see below text and also the sent link..
    If a navigation attribute is used in an aggregate, this aggregate has to be adjusted using a change run as soon as new values are loaded for the navigation attribute (when master data for the characteristic belonging to the navigation attribute is loaded.) This change run is usually one of the processes that are critical to the system performance of a production BW system. This is why, by avoiding using navigation attributes or not using navigation attributes in aggregates, you can improve the performance of this process. On the other hand, not using navigation attributes in aggregates can lead to poor query response times. The data modeler needs to find the right balance.
    http://help.sap.com/saphelp_nw04/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm
    cheers,
    Vishvesh

  • Dynamically passing the values to IN query in JDBC

    Hi,
    I have a list which contains a single or multiple values which does have CustomerVO as a generic.Here i need to iterate the list pass these values to "IN" query.
    These should happen dynamically, as we dont know whether the list will hold a single or multiple value. If the list.size ==1 , then it contains a single value in it. Hence there is no need for a comma(,) in the IN query else we need to have it, like .... IN (Aaron,Bob). Please help me in this?
    Thanks.

    797836 wrote:
    I have a list which contains a single or multiple values which does have CustomerVO as a generic.Here i need to iterate the list pass these values to "IN" query.
    These should happen dynamically, as we dont know whether the list will hold a single or multiple value. If the list.size ==1 , then it contains a single value in it. Hence there is no need for a comma(,) in the IN query else we need to have it, like .... IN (Aaron,Bob).So basically you need to output the List (capital 'L') as a comma-delimited list (small 'l').
    The procedure for that is usually something like:
    1. Output the first element.
    2. For any further elements:
    2a. Output ","
    2b. Output the element.
    Winston

Maybe you are looking for

  • Two facetimes with one apple ID?

    I just bought my daughter an iPod Touch. I have an iPhone. I registered her touch under my apple id. When I went to check her settings on face time, it had my email under it. So I changed it to hers and deleted mine then it linked me to apple to conf

  • Can I recover the database to the current time using a backup control file?

    Can I recover the database to the current time using a backup control file? How far can I recover this database? I have an Oracle 10g(10.2.3) database on RHEL4.3 system. I have lost all the current control files and all the online redo logs, archived

  • IPhoto is taking TOO much cmd from my MacBook Pro !!

    Hello ! iPhoto is taking too much cmd from my computer. When im looking at photos the cpu jumps up to 80-90% of my CPU en when i'm editing photos it can jump up to 160% !!!! Thats just way too much. It *** to be on this good computer and cannot look

  • Form returned in .txt format

    I have designed a form in Adobe Designer 7.0 and have used it several times and it has worked just fine. The returned forms come back in the _data.xml format and I can import the data easily. I wonder why the last one somebody sent came back in .txt

  • SDK:  Changing drop shadow effect properties

    I have a text object that I've done Effect->Stylize->Drop Shadow... on. Using the COM SDK for Illustrator CS6, as an Illustrator.TextFrame object, how can I access the properties of this drop shadow effect?