Cast ascii to decimal

hi
im having a slight issue converting ascii to decimal.
i have an ascii string which is basically an incrementing number.
when i look at it as a hex string (by setting hex code in an indicator) i get:
0001
0002
0003
and so on.
however, when i convert this ascii string to decimal i get really large numbers.
when i get 0002 the decimal number is 131072.
this is equivalent to 20000 hex.
so it appears that i have 4 trailing hex zeros in there. not sure where they come from or how to get rid of them.
any ideas anyone?

slugger wrote:
im having a slight issue converting ascii to decimal.
Next time also try to be more specific.
The words "cast" and "convert" mean very different things, so don't use them interchangeably. (detals)
Your input is NOT ASCII (a character encoding scheme) but just a plain string.
The word "decimal" is a formatting specification, not a numeric data type.
Your problem also shows why type cast is relatively dangerous unless you know exactly what you are doing. There is no error output, e.g. if the string is shorter than needed for the datatype. It would be safer to use "unflatten from string" becaue it would alert you about the data mismatch at run time.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • ASCII to decimal to ASCII

    Hi all,
    i have a question. This is what is like to build.
    i have a string value something like "abcd"
    now i like to convert the caracters in this string to a decimal value cracter by caracter, do a calculation and bring it back to a ASCII value
    like this:
    a = 097
    b = 098
    c = 099
    d = 100
    then
    097 - 4 = 093
    098 - 4 = 094
    099 - 4 = 095
    100 - 4 = 096
    then
    093 = ]
    094 = ^
    095 = _
    096 = `
    so the output of the program is not:
    abcd
    but it should be :
    ]^_`
    any thought how this should be done???
    Regards Johan

    You can read one-by-one character in your String, using the method char charAt (int position). For example, let's say your String is str. You can do like this:
    String str = "abcd";
    for (int cont = 0; cont < str.length (); cont += 1)
       System.out.print ("" + (str.charAt (cont) - 4) );If you want to have the decimal value of the character, you need to do a cast. For example:
    String str = "abcd";
    int i;
    i = (int) str.charAt (2);
    System.out.println ("" + i);In this case, it will display the ASCII value of 'c' (the character number 2 of str) on your standard output stream.
    Hope this helps.
    Antonielly.

  • Ascii to Decimal - Eating my Brain. Urgent please

    Dear Friends
    I am facing pblm while converting ascii to dec.
    at present my program is supporting to this..
    ascii     dec
    a      61
    but, when i give "aa" it is still saying 61 as decimal.
    how can i make my program to get this type of result
    aa     6161
    aaa     616161
    is it possible.
    please help me.
    Thanks in advance
    Yours
    Rajesh

    Dear Smith
    Thankyou VeryMuch.
    My Code is like this.
    try {
         String strInput = asciiTextField.getText();
         try
              byte [] aByteArr = strInput.getBytes();
              try{
                   aByteArr[0] = aSCIITableFile.parseByte(strInput);
                   decTextField.setText(Byte.toString(aByteArr[0]));
                   return;
              }catch(Exception e){}
              if(aByteArr.length > 4) throw new Exception();
                   byte aByte = aByteArr[0];
                   decTextField.setText(Byte.toString(aByte));
         }catch(Exception e){
              JOptionPane.showMessageDialog(this,"Wrong ASCII value","Error",JOptionPane.ERROR_MESSAGE);
    } catch (java.lang.Exception e) {
    please tell me how to iterate the value.
    Please help me.
    Thanks in advance
    Yours
    Rajesh

  • Need help with converting date format to decimal in SSRS expression.

    Hi all,
    I have a decimal data type column with a record in the following format 20150219 --> yyyyMMdd. And I am trying to convert the return value from SSRS date/time parameter to a decimal value.
    The TMDTOP column is the decimal data type with date records in yyyyMMdd format.
    My return parameter is the following:
    =IIf(IsNothing(Parameters!SystemDate.Value),Fields!TMDTSY.Value,CDec(Format(Parameters!SystemDate.Value,"yyyyMMdd"))) 
    When I try to run the report I get the following error:
    Failed to evaluate the FilterValue of the DataSet ‘DataSet1’. (rsFilterEvaluationError)
    I appreciate if anyone can help me on solving this problem.
    Thanks in advance.

    why casting date to decimal here? Can you explain?
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Decimal value automatically converting into int

    Hi,
    I have a SQL column which is a string and its value is casted to have decimal value. For example 92.57
    In C#, below is the code I have written to retreive the value.
    command.Parameters.Add("@ProcessCompliance", SqlDbType.Decimal).Direction = ParameterDirection.Output;
     ProcessComplaincecount = command.Parameters["@ProcessCompliance"].Value.ToString());
    But value is getting converted as 93 as a int. I want it as 92.57
    Regards, Shreyas R S

    For best results, you should post this question in the SQL development or C# forums. (This is a SharePoint forum.)
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • Trying to limit the fidelity (to 2 decimal places) of a calculated value?

    Hi Everyone,
    I have a column that shows the Profit / Loss % for items sold.
    ISNULL(((T0.LineTotal - T0.StockValue) / NULLIF(T0.StockValue, 0)) * 100, 0
    Because it is possible for StockValue to be a zero (0) amount in our system it was necessary to add the NULLIF function.
    If a NULL value is detected then a value of 0 is ultimately returned. Due to the fact that there could still be a profit or a loss in this column I needed to add 'N/A', which I achieved by casting the calculation to a varchar and then applying a CASE statement, the full syntax is as follows -
    CAST(ISNULL(((T0.LineTotal - T0.StockValue) / NULLIF(T0.StockValue, 0)) * 100, 0) AS varchar) = '0.00000000000000' THEN 'N/A'
    ELSE CAST(ISNULL(((T0.LineTotal - T0.StockValue) / NULLIF(T0.StockValue, 0)) * 100, 0) AS varchar) END
    AS 'Profit / Loss %'
    My challenge is that the % for profit has an excessive level of fidelity, it currently goes to 14 decimal places (e.g.: 134.43223443223443)!
    I would like to limit the fidelity to 2 decimal places (e.g: 134.43). I have attempted to do this by 'double casting', first casting to a decimal then to a varchar (to allow for the 'N/A') -
    CAST(CAST(ISNULL(((T0.LineTotal - T0.StockValue) / NULLIF(T0.StockValue, 0)) * 100, 0) AS decimal) AS varchar)
    In this case the fidelity is not sufficient, and I lose all decimal places. If I stipulate the nature of the decimal place, e.g.: decimal(4,2), then I get an "arithmetic overflow" error.
    How can I make my results either 'N/A' or a numeric result (with 2 decimal places)?
    Any help will be greatly appreciated.
    Kind Regards,
    David

    Hi David...
    Check this
    *    Purpose: Lists the Sales History of Items by (user designated): 
    *    Item Code (range) and / or    
    *    Whs Code (range) and / or 
    *    Industry Code and / or    
    *    BP (Customer Code) 
    DECLARE @begItemCode nvarchar(20), @endItemCode nvarchar(20), @whsCode nvarchar(5), @indCode nvarchar(5), @custNo nvarchar(10) 
    SET @begItemCode = '' 
        IF @begItemCode = '' 
            SET @begItemCode = '00%' 
    SET @endItemCode = '' + 'Z' 
        IF @endItemCode = 'Z' 
            SET @endItemCode = 'ZZ%' 
    SET @whsCode = '' 
        IF @whsCode = '' 
            SET @whsCode = '%' 
    SET @indCode = '' 
        IF @indCode = '' 
            SET @indCode = '%' 
    SET @custNo = 'C000002' 
        IF @custNo = '' 
            SET @custNo = '%' 
            select tt.[Document Date],tt.[Document No.],tt.[Doc Type],tt.[Cust Code],tt.[Customer Name],tt.[Item Code],tt.[Item Description] ,
            tt.whscode, tt.[Line Net],tt.[Line Cost],tt.[Itm Avg Cost] , tt.[Profit / Loss],
            cast(round(tt.[Profit / Loss %],2,0) as decimal(18,2) ) as 'PL%',tt.[Vendor Name],tt.[Salesman Name] from (
    SELECT 
    T1.DocDate AS 'Document Date' 
    , T1.DocNum AS 'Document No.' 
    , 'Invoice' AS 'Doc Type' 
    , T1.CardCode AS 'Cust Code' 
    , T1.CardName AS 'Customer Name' 
    , T0.ItemCode AS 'Item Code' 
    , T0.Dscription AS 'Item Description' 
    , T0.Quantity AS 'Ship Qty' 
    , T0.WhsCode 
    , T0.LineTotal AS 'Line Net' 
    , T0.StockValue AS 'Line Cost' 
    , T2.AvgPrice AS 'Itm Avg Cost' 
    , (T0.LineTotal - T0.StockValue) AS 'Profit / Loss' 
    , CASE WHEN 
    --ROUND(
      CAST(ISNULL(((T0.LineTotal - T0.StockValue) / NULLIF(T0.StockValue, 0)) * 100, 0) AS varchar) = '0.00000000000000' THEN 'N/A' 
      ELSE CAST(ISNULL(((T0.LineTotal - T0.StockValue) / NULLIF(T0.StockValue, 0)) * 100, 0) AS varchar) END    
      AS 'Profit / Loss %' 
    , T4.CardName AS 'Vendor Name' 
    , T5.SlpName AS 'Salesman Name' 
    FROM  dbo.INV1 T0 
    INNER JOIN  dbo.OINV T1 ON T1.DocEntry = T0.DocEntry 
    INNER JOIN  dbo.OITM T2 ON T2.ItemCode = T0.ItemCode 
    INNER JOIN  dbo.ITM1 T3 ON T3.ItemCode = T0.ItemCode AND T3.PriceList = 1 
    INNER JOIN  DBO.OCRD T4 ON T4.CardCode = T2.CardCode 
    INNER JOIN  DBO.OSLP T5 ON T5.SlpCode = T1.SlpCode 
    WHERE T1.DocType = 'I' AND T2.OnHand > 0 AND T0.ItemCode >= @begItemCode AND T0.ItemCode <= @endItemCode AND T0.WhsCode LIKE @whsCode 
    AND T2.U_SCE_IN_Industry LIKE @indCode AND T1.CardCode LIKE @custNo 
    UNION ALL 
    SELECT 
    T10.DocDate AS 'Document Date' 
    , T10.DocNum AS 'Document No.' 
    , 'Credit' AS 'Doc Type' 
    , T10.CardCode AS 'Cust Code' 
    , T10.CardName AS 'Customer Name' 
    , T9.ItemCode AS 'Item Code' 
    , T9.Dscription AS 'Item Description' 
    , -1 * T9.Quantity AS 'Ship Qty' 
    , T9.WhsCode 
    , -1 * T9.LineTotal AS 'Line Net' 
    , -1 * T9.StockValue AS 'Line Cost' 
    , T11.AvgPrice AS 'Itm Avg Cost' 
    , -1 * (T9.LineTotal - T9.StockValue) AS 'Profit / Loss' 
    , CASE WHEN 
      CAST(ISNULL(((T9.LineTotal - T9.StockValue) / NULLIF(T9.StockValue, 0)) * -100, 0) AS varchar) = '0.00000000000000' THEN 'N/A' 
      --ELSE CAST(CAST(ISNULL(((T9.LineTotal - T9.StockValue) / NULLIF(T9.StockValue, 0)) * -100, 0) AS decimal) AS varchar) END 
      ELSE CAST(ISNULL(((T9.LineTotal - T9.StockValue) / NULLIF(T9.StockValue, 0)) * -100, 0) AS varchar) END 
      AS 'Profit / Loss %' 
    , T13.CardName AS 'Vendor Name' 
    , T14.SlpName AS 'Salesman Name' 
    FROM  dbo.RIN1 T9 
    INNER JOIN  dbo.ORIN T10 ON T10.DocEntry = T9.DocEntry 
    INNER JOIN  dbo.OITM T11 ON T11.ItemCode = T9.ItemCode 
    INNER JOIN  dbo.ITM1 T12 ON T12.ItemCode = T9.ItemCode AND T12.PriceList = 1 
    INNER JOIN  DBO.OCRD T13 ON T13.CardCode = T11.CardCode 
    INNER JOIN  DBO.OSLP T14 ON T14.SlpCode = T10.SlpCode 
    WHERE T10.DocType = 'I' AND T9.ItemCode >= @begItemCode AND T9.ItemCode <= @endItemCode AND T9.WhsCode LIKE @whsCode 
    AND T11.U_SCE_IN_Industry LIKE @indCode AND T10.CardCode LIKE @custNo  
      ) as tt
    Hope Helpful
    Regards
    Kennedy

  • Exponential values that does not insert in a decimal column

    Hi guys, I have a table FORUM with a column SOLDITEM varchar that contain numeric data in 99% of the case but sometime even values like 8.9312784E-7 ( bear in mind that the data comes from Oracle --> Csv file --> SQL).
    now I'm trying to insert these data into a decimal column but of course it retrieves:
    Error converting data type varchar to numeric.
    the select is
    cast
    ([SoldItem]
    as
    decimal
    (38,5))
    Is there something I can do directly on the select or I need to update the table forum before? and in that case how can I recognized the value like  8.9312784E-7?
    Thanks a lot

    The problem is that I got more than '8.9312784E-7' like 1.3356586E4-3 etc.
    I am trying
    cast
    case
    when
    ltrim(rtrim([SoldItem]))
    in('.',
    '+',
    '+.')
    then 0
    when
    ltrim(rtrim([SoldItem]))
    like
    '%[^-+.0-9]%'
    then 0
    else
    isnumeric([SoldItem]))
    as
    decimal
    (38,5))
    but it looks that there is something wrong with the brackets..
     

  • How to remove trailing zeros from a decimal (type) value?

    Hi Everyone,
    I would like to 'drop' some trailing zeros from a decimal value, e.g.: 50.000000, and I am wondering how to go about this?
    The value is definitely of decimal type, and in this instance I know that I want to eliminate exactly six (6) zeros.
    Any help here will be greatly appreciated.
    Kind Regards,
    David

    Try the below:
    This is sort of a display issue, you may do it at Application side, which would be efficient.
    Declare @s Decimal(10,6)='50.0000000'
    Select Cast(@s as decimal(10,0))

  • TRY CAST and setting the type according to destination column

    Hi,
    I am loading data from different sources. I have to do data quality checks for data I am loading into destination. For Decimal Values I have destination data types Decimal(28,2) and Decimal(28,6) 
    I would like to check the source data and covert the type according to destination column. How can I use the try cast in this scenario?
    SELECT TRY_CAST(REPLACE('100,500.000',',','') AS DECIMAL(28,2))
    this statement will convert every thing to two decimal places. but if destination column is decimal(28,6) i would like to convert it to 100500.657899
    What is the best way of doing it?
    MH

    Hi MH,
    According to your description, you need to CAST and setting the type according to destination column which data types is Decimal(28,2) and Decimal(28,6), right?
    "this statement will convert every thing to two decimal places. but if destination column is decimal(28,6) i would like to convert it to 100500.657899" If in this case, then there are different data types on the same column which is not
    supported in current version. So as per my understanding, there is no such a functionality to achieve your requirement. What we can do is convert to corresponding datatype (Decimal(28,2) or Decimal(28,6)), and then convert it to nvarchar datatype.
    CREATE TABLE #TEMP(A NVARCHAR(50))
    INSERT INTO #TEMP VALUES('1538.21'),('1635.326541'),('136.235')
    SELECT
    A,
    CASE
    WHEN (LEN(RIGHT(A,LEN(A)-PATINDEX('%.%',A))))>2
    THEN
    CAST(A AS DECIMAL(28,6))
    WHEN (LEN(RIGHT(A,LEN(A)-PATINDEX('%.%',A))))<=2
    THEN
    CAST(A AS DECIMAL(28,2))
    END AS B,
    CASE
    WHEN (LEN(RIGHT(A,LEN(A)-PATINDEX('%.%',A))))>2
    THEN
    CAST(CAST(A AS DECIMAL(28,6)) AS VARCHAR(99))
    WHEN (LEN(RIGHT(A,LEN(A)-PATINDEX('%.%',A))))<=2
    THEN
    CAST(CAST(A AS DECIMAL(28,2)) AS VARCHAR(99) )
    END AS B2
    FROM #TEMP
    DROP TABLE #TEMP
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Rounding Differences between TSQL Cast and Data Conversion component

    This is using SSIS 2012.  We are using an Ole Db Connection manager using the Microsoft.ACE.OLEDB.12.0 provider.
    I have an Access database (accdb). It has several columns that are coming into SSIS as real data types.  One column has a value of 68.8335558900872.
    In the past we used the Data Conversion to convert from real to numeric 18, 6.  The result was 68.833555.  Rather than rounding on the last decimal place, it is returning the floor at six decimal places.
    We have converted the process to load the data into a real data type column and then use a view to cast the value to a Decimal 18,6 (CAST (Col1 as Decimal(18,6))).  We then load the data into a decimal 18,6 column.  The result is 68.833556, which
    is the rounded version of the real value.
    Personally I prefer the rounded version rather than the truncated version.
    I am trying to explain to explain to the QA people why the revised process is producing different results and thus I want to know if these are known behaviors for TSQL Cast and the Data Conversion component.
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

    I think such a post is more suitable for an MS Connect bugs section as I see it a defect. And it seems no floor, but simply cutting off. Try in .Net when you convert, does it work the same? Data Conversion is a wrapper around the .net
    Arthur My Blog

  • Export SQL View to Flat File with UTF-8 Encoding

    I've setup a package in SSIS to export a SQL view to a flat file and it's working fine.  I now need to make that flat file UTF-8 encoded.  The package executes but still shows the files as ANSI encoded.
    My package consists of a Source (SQL View) -> Derived Column (casts the fields to DT_WSTR) -> Destination Flat File (Set to output UTF-8 file).
    I don't get any errors to help me troubleshoot further.  I'm running SQL Server 2005 SP2.

    Unless there is a Byte-Order-Marker (BOM - hex file prefix: EF BB BF) at the beginning of the file, and unless your data contains non-ASCII characters, I'm unsure there is a technical difference in the files, Paul.
    That is, even if the file is "encoded" UTF-8, if your data is only ASCII values (decimal values 0-127, hex 00-7F), UTF-8 doesn't really serve a purpose over ANSI encoding.  Now if you're looking for UTF-8 with specifically the BOM included, and your data is all standard ASCII, the Flat File Connection Manager can't do that, it seems.
    What the flat file connection manager is doing correctly though, is encoding values that are over decimal 127/hex 7F in UTF-8 when the encoding of the connection manager is set to 65001 (UTF-8).
    Example:
    Input data built with a script component as a source (code at the bottom of this post) and with only one WSTR output column hooked to a flat file destination component:
    a string containing only decimal value 225 (german Eszett character - ß)
    Encoding set to ANSI 1252 looks like:
    E1 0D 0A (which is the ANSI encoding of the decimal character value 225 (E1) and a CR-LF (0D 0A)
    Encoding set to UTF-8 65001 looks like:
    C3 A1 0D 0A  (which is the UTF-8 encoding of the decimal character value 225 (C3 A1) and a CR-LF (0D 0A)
    Note that for values over decimal 127, UTF-8 takes at least two bytes and up to four for the remaining values available.
    So, I'm comfortable now, after sitting down and going through this, that the flat file connection manager is working correctly, unless you need a BOM.
    1
    Imports System  
    2
    Imports System.Data  
    3
    Imports System.Math  
    4
    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper  
    5
    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper  
    6
    7
    Public Class ScriptMain  
    8
        Inherits UserComponent  
    9
    10
        Public Overrides Sub CreateNewOutputRows()  
    11
            Output0Buffer.AddRow()  
    12
            Output0Buffer.col1 = ChrW(225)  
    13
        End Sub 
    14
    15
    End Class 
    Phil

  • Labview 7i problems

    the conversion from ascii to decimal is done with labview 2011. But using labview 7i the conversion is not happening. I had done the same mechanism like the numeral in U8 form to indicator. ANd other part is attached to string . Type is given as 0. But the wiring has not happened between the type cast and the numeral. It says they belongs to different forms. SO how can i ovrecome this problem. please help me.

    Why are you constantly starting new discussions about the same old thing????
    Please keep it all in one place!
    continued here (or here)
    perumpadapu wrote:
    Type is given as 0.
    zero is not a type, it is a value.
    LabVIEW Champion . Do more with less code and in less time .

  • How to write a sql query to calculate weights using CTE

    Hi guys,
    want some help using a CTE to generate data using recursive SQL - input data in table A to be transformed into table B shown below
    Table A
    Instru_id_index     instru_id_name    instru_id_constit  con_name   weight
            56                       INDEX A                     
    23                  A                 25
            56                       INDEX A                     
    24                 B                  25
            56                       INDEX A                     
    25                  C                 25
            56                       INDEX A                     
    57              
    INDEX  B       25
            57                      
    INDEX B                     31                 
    D                 33
            57                      
    INDEX B                     32                 
    E                  33
            57                      
    INDEX B                     33                 
    F                  33
    (Logic should be recursive in order to be able to handle multi-level, not just level 2.)
    Table B
    Instru_id_index     instru_id_name    instru_id_constit  constit_name   weight
            56                       INDEX A                        
    23                A                   25
            56                       INDEX A                        
    24                B                   25
            56                       INDEX A                        
    25                C                   25
            56                       INDEX A                        
    31                D                   8.3
            56                       INDEX A                        
    32                E                    8.3
            56                       INDEX A                        
    33                F                    8.3
            57                       
    INDEX B                       31                
    D                   33
            57                       
    INDEX B                       32                E                   
    33
            57                       
    INDEX B                       33               
    F                     33
    how can I write a simple CTE construct to  display the data in table B -  How can i calculate the values of weights as 8.3 respectively - calculate these without changing the structure of the tables.
    Can I do this in a CTE

    Full join?
    Anyway, thanks for Rsignh to produces a script with CREATE TABLE and INSERT statements. I've extended the data to one more level of recursion.
    create table weight_tab(
     instrument_id_index int,
     instrument_id_name varchar(10),
     instrument_id_constituent int,
     constituent_name varchar(10),
     [weight] decimal(10,2))
     insert into weight_tab values
     (56,'INDEX A',23,'A',25),(56,'INDEX A', 24,'B',25),
    (56,'INDEX A',25,'C',25),(56,'INDEX A', 57,'INDEX  B',25),
    (57,'INDEX B',31,'D',33), (57,'INDEX B', 32,'INDEX E',33),
    (57,'INDEX B',33,'INDEX C',33),
    (33,'INDEX C',42,'Alfa',60),
    (33,'INDEX C',43,'Beta',40),
    (32,'INDEX C',142,'Gamma',90),
    (32,'INDEX C',143,'Delta',10)
    go
    SELECT * FROM weight_tab
    go
    ; WITH rekurs AS (
        SELECT instrument_id_index, instrument_id_name, instrument_id_constituent,
               cast(weight as float) AS weight, cnt = 1
        FROM   weight_tab a
        WHERE  NOT EXISTS (SELECT *
                           FROM   weight_tab b
                           WHERE  b.instrument_id_constituent = a.instrument_id_index)
        UNION ALL
        SELECT r.instrument_id_index, r.instrument_id_name, w.instrument_id_constituent,
               r.weight * w.weight / 100, r.cnt  + 1
        FROM   rekurs r
        JOIN   weight_tab w ON r.instrument_id_constituent = w.instrument_id_index
        WHERE r.cnt < 4
    SELECT instrument_id_index, instrument_id_name, instrument_id_constituent,
           cast(weight AS decimal(10,2))
    FROM   rekurs
    go
    DROP TABLE weight_tab
    Erland Sommarskog, SQL Server MVP, [email protected]

  • SQL Server 2008 R2 - Report Builder 3.0 - timeout using shared data source and stored procedure

    I select the shared datasource from the data source propeties dialog, test the connection and everything is good.
    I add a dataset by selecting "use a dataset embedded in my report" option within the Dataset properties dialog.
    I select the newly added data source, click the "Stored procedure" query type and drop down the list box and select my intended stored procedure.
    the timeout for the dataset is "0" seconds.
    I click the "OK" button and I'm presented with the parameters to the stored procedure.
    I enter valid data for the parameters and click the "OK" button.
    I then get the following error message after 30 seconds:
    The problem is, all of the timeouts, that I'm aware of, have values of zero (no timeout) or high enough values that 30 seconds isn't even close to the timeout.
    I think the smallest timeout we have is 120 seconds.
    I have searched this site and many others and the solutions all involve altering the stored procedure to get the fields into report builder and then revert the stored procedure back to its original form.
    To me, this is NOT a solution.  
    I have too many stored procedures that need to be brought into Report Builder.
    I need a real solution.
    Thank you for you time, Tim Caldwell.
    Timothy E Caldwell

    I don't mean to be rude, but really, check to see if the stored procedure can return data rows???
    Maybe I'm not being clear enough.
    The stored procedure runs perfectly fine.
    it runs perfectly fine in the production environment and the test environment.
    I can access the stored procedure in several ways and have it return correct data.
    I can even trick report builder into creating a dataset with parameters and run the stored procedure that way.
    What I cannot do, is to get report builder to not timeout after 30 seconds on the initial creation of a dataset with a Query type of stored procedure.
    I have seen this issues posted again and again and again on may different sites and the "solution" is to simplifiy the stored procedure by creating a stored procedure that has a create table and a select in the stored procedure and that's it.  After
    report builder creates the dataset the developer then has to replace the simplified stored procedure with the actual stored procedure and everything works fine after that.
    HOWEVER, having to go through this process for 70 or more stored procedures is ridiculous.
    It would appear that there is something within report builder itself that is causing this issue.
    The SQL Script included is an example of a stored procedure that will not create fields create a dataset with fields and parameters in Report Builder 3.0:
    USE [CRUM_IT]
    GO
    /****** Object: StoredProcedure [dbo].[COGNOS_Level5ScriptSP] Script Date: 11/17/2014 08:02:26 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER procedure [dbo].[COGNOS_Level5ScriptSP]
    @CompanyCode varchar(8) = null,
    @GetSiblings varchar(1) = 'N'
    as
    Begin
    -- get emergency contact info
    select *
    into #tmp_Contacts
    from
    (select
    ConEEID,
    con.connamelast as [Emer Contact Last Name],
    con.connamefirst as [Emer Contact First Name],
    con.connamemiddle as [Emer Contact Middle Initial/Name]--,
    ,ROW_NUMBER() over (Partition by ConEEID order by ConNameLast)as rn
    ,ISNULL(
    case when con.conphonepreferred = 'H'
    then '(' + substring(con.conphonehomenumber, 1, 3) + ')' + substring(con.conphonehomenumber, 4, 3) + '-' + substring(con.conphonehomenumber, 7, 4)
    else '(' + substring(con.conphoneothernumber , 1, 3) + ')' + substring(con.conphoneothernumber , 4, 3) + '-' + substring(con.conphoneothernumber , 7, 4)
    end,
    ) as [Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.Contacts con
    where con.ConIsEmergencyContact='y'
    and con.ConIsActive='y'
    ) A
    where A.rn = 1
    CREATE TABLE #tmp_CompanyCodes (CompanyCode varchar(8))
    If @GetSiblings = 'Y'
    Begin
    INSERT INTO #tmp_CompanyCodes (CompanyCode)
    EXEC [z_GetClientNumbers_For_ParentOrg_By_ClientNumber] @CompanyCode
    End
    INSERT INTO #tmp_CompanyCodes
    values (@CompanyCode)
    select *
    into #tmp_Company
    from [ultiprosqlprod1].[ultipro_crum].dbo.Company
    where cmpcompanycode in (select CompanyCode from #tmp_CompanyCodes)
    select distinct
    cmpcompanycode as [Client ID],
    CmpCompanyDBAName as [Client Name],
    eec.eecEmplStatus AS [Employment Status],
    eec.eecEmpNo AS [Employee Num],
    rtrim(eep.eepNameLast) AS [Last Name],
    rtrim(eep.eepNameFirst) AS [First Name],
    isnull(rtrim(ltrim(eep.eepNameMiddle)), '') AS [Middle Initial/Name],
    rtrim(eep.eepAddressLine1) AS [Address Line 1],
    isnull(rtrim(eep.eepAddressLine2), '') AS [Address Line 2],
    eep.eepAddressCity AS [City],
    eep.eepAddressState AS [State],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 1, 5)
    ELSE rtrim(eep.eepAddressZipCode)
    END AS [Zip code],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 6, 4)
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) > 0
    THEN substring(eep.eepAddressZipCode, charindex(eep.eepAddressZipCode, '-', 1) + 1, 4)
    WHEN len(eep.eepAddressZipCode) <= 5
    THEN ''
    END AS [ZIP + 4],
    substring(eep.eepSSN, 1, 3) + '-' + substring(eep.eepSSN, 4, 2) + '-' + substring(eep.eepSSN, 6, 4) AS [SSN],
    isnull(convert(VARCHAR(10), eep.eepDateOfBirth, 101), '') AS [Date Of Birth],
    eetFED.TAXCODE AS [FED Tax Code],
    eetFED.FILINGSTATUS AS [Fed Filing Status],
    eetFED.EXEMPTIONS AS [Fed Exemption Allowance],
    eetFED.ADDITIONAL AS [Additional Fed Withholding],
    eetSIT.TAXCODE AS [SIT Tax Code],
    eetSIT.FILINGSTATUS AS [State Filing Status],
    eetSIT.EXEMPTIONS AS [State Exemption Allowance],
    eetSIT.ADDITIONAL AS [Additional State Withholding],
    isnull('(' + substring(eep.eepPhoneHomeNumber, 1, 3) + ')' + substring(eep.eepPhoneHomeNumber, 4, 3) + '-' + substring(eep.eepPhoneHomeNumber, 7, 4), '') AS [Home Phone],
    isnull((SELECT cod.codDesc
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.Codes cod WITH (NOLOCK)
    WHERE cod.codCode = eep.eepEthnicID
    AND cod.codDosTable = 'ETHNICCODE'), '') AS [Race-Origin], --eep.eepEthnicID AS [Race-Origin],
    eep.eepGender AS [Gender],
    isnull(convert(VARCHAR(10), eec.eecDateOfOriginalHire, 101), '') AS [Original Hire Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfSeniority, 101), '') AS [Seniority Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfTermination, 101), '') AS [Termination Date],
    isnull(eecTermType,'') as [Termination Type],
    isnull(TchDesc, '') as [Termination Reason],
    rtrim(eec.eecJobCode) AS [WC Code],
    isnull(eec.eecJobTitle, '') AS [Job Title],
    pgr.pgrPayFrequency AS [Pay Frequency],
    eec.eecFullTimeOrPartTime AS [Full/Part Time],
    eec.eecSalaryOrHourly AS [Pay Type],
    isnull(convert(MONEY, eec.eecHourlyPayRate), 0.00) AS [Hourly Rate],
    isnull(eec.eecAnnSalary, 0.00) AS [Annual Salary],
    [YTD Hours],
    isnull(eep.eepNameFormer, '') AS [Maiden Name],
    eec.eecLocation AS [Location ID],
    rtrim(eec.eecOrgLvl1) AS [Department ID],
    eec.eecorglvl2 AS [Cost Item],
    eec.eecorglvl3 as [Client Project],
    eec.eecPayGroup as [Pay Group],
    isnull(eepAddressEMail,' ') as [Email Address],
    isNull(BankName1,' ') as PrimaryBank,
    isNull(BankRoute1,' ') as PrimaryRouteNum,
    isNull(Account1,' ') as PrimaryAccount,
    isNull(AcctType1,' ') as PrimaryAcctType,
    isNull(DepositRule1,' ') as PrimaryDepositRule,
    isNull(BankName2,' ') as SecondaryBank,
    isNull(BankRoute2,' ') as SecondaryRouteNum,
    isNull(Account2,' ') as SecondaryAccount,
    isNull(AcctType2,' ') as SecondaryAcctType,
    isNull(DepositRule2,' ') as SecondaryDepositRule,
    isNull(
    CASE
    WHEN DepositRule2 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct2 AS decimal(10,2)))
    WHEN DepositRule2 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct2*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as SecondaryDepositAmount,
    isNull(BankName3,' ') as ThirdBank,
    isNull(BankRoute3,' ') as ThirdRouteNum,
    isNull(Account3,' ') as ThirdAccount,
    isNull(AcctType3,' ') as ThirdAcctType,
    isNull(DepositRule3,' ') as ThirdDepositRule,
    isNull(
    CASE
    WHEN DepositRule3 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct3 AS decimal(10,2)))
    WHEN DepositRule3 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct3*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as ThirdDepositAmount,
    Supervisor,
    eec.eecEEID AS [Employee EEID],
    eec.EecJobCode As [Job Code],
    isnull(eec.EecTimeclockID,' ') As [Time Clock ID],
    con.[Emer Contact Last Name],
    con.[Emer Contact First Name],
    con.[Emer Contact Middle Initial/Name],
    con.[Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.empPers eep WITH (NOLOCK)
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.empComp eec WITH (NOLOCK)
    ON eep.eepEEID = eec.eecEEID
    inner join #tmp_Company cmp WITH (NOLOCK)
    ON eec.eecCOID = cmp.cmpCOID
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.PayGroup pgr WITH (NOLOCK)
    ON eec.eecPayGroup = pgr.pgrPayGroup
    left outer join [ultiprosqlprod1].[ultipro_crum].dbo.TrmReasn
    on tchCode = eecTermReason
    left join (select CAST(sum(isnull(eee.eeeYTDHrs,0.00))AS DECIMAL(18,2)) as [YTD Hours],
    eeeEEID,
    eeeCOID
    from [ultiprosqlprod1].[ultipro_crum].dbo.EmpEarn eee with (NOLOCK)
    group by eeeCOID,eeeEEID)eee
    on eec.eecEEID = eee.eeeEEID
    and eec.eecCOID = eee.eeeCOID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode = 'USFIT'
    )eetFED
    ON eec.eecCOID = eetFED.COID
    and eec.eecEEID = eetFED.EEID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode like '%SIT'
    AND eetIsWorkInTaxCode = 'Y'
    )eetSIT
    ON eec.eecCOID = eetSIT.COID
    and eec.eecEEID = eetSIT.EEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName1,
    eddEEBankRoute BankRoute1,
    eddAcct Account1,
    EddAcctType AcctType1,
    EddDepositRule DepositRule1,
    EddAmtOrPct EddAmtOrPct1
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '99')edd
    ON eec.eecCOID = edd.eddCOID
    and eec.eecEEID = edd.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName2,
    eddEEBankRoute BankRoute2,
    eddAcct Account2,
    EddAcctType AcctType2,
    EddDepositRule DepositRule2,
    EddAmtOrPct EddAmtOrPct2
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '01')edd2
    ON eec.eecCOID = edd2.eddCOID
    and eec.eecEEID = edd2.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName3,
    eddEEBankRoute BankRoute3,
    eddAcct Account3,
    EddAcctType AcctType3,
    EddDepositRule DepositRule3,
    EddAmtOrPct EddAmtOrPct3
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '02')edd3
    ON eec.eecCOID = edd3.eddCOID
    and eec.eecEEID = edd3.eddEEID
    left outer join (SELECT eecCOID,
    eecEEID,
    rtrim(eepNameLast) + ', ' +
    rtrim(eepNameFirst) + ' ' +
    isnull(rtrim(ltrim(eepNameMiddle)), '') AS [Supervisor]
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpComp WITH (NOLOCK)
    join [ultiprosqlprod1].[ultipro_crum].dbo.EmpPers with (NoLock)
    on eeceeid = eepeeid)eec2
    ON eec.eecSupervisorID = eec2.eecEEID
    left outer join #tmp_Contacts con
    on eep.eepEEID = con.ConEEID
    order by [Client ID],
    [Last Name],
    [First Name]
    drop table #tmp_Contacts
    END
    Timothy E Caldwell

  • Expressions with different data types

    hello
    I have an animated clock and a line on a chart that I want to animate together--hopefully all tied with expressions, to make easing across them very *easy*
    I've got the big hand and little hand of the clock linked up (pick-wipped rotation and multiplied * 12) but I'm wondering if I can do something similar for the line on the chart (in this case I'm animating the line with stroke>generate, but I'm open to suggestions)
    thanks!
    LML

    The type is decimal, the precision 16 and scale is 12.
     select SQL_VARIANT_PROPERTY(CAST(10 AS decimal(5,1)) / CAST(140 AS int),'BaseType') as Type
    ,SQL_VARIANT_PROPERTY(CAST(10 AS decimal(5,1)) / CAST(140 AS int),'Precision') as Precision
    ,SQL_VARIANT_PROPERTY(CAST(10 AS decimal(5,1)) / CAST(140 AS int),'Scale') as Scale
    The calculation for determining the scale of the result can be found here: 
    https://msdn.microsoft.com/en-AU/library/ms190476.aspx
    Basically it is max(6, s1 + p2 + 1) where s1 is the scale of the numerator and p2 is the precision of the denominator. 
    In your case max(6,1+10+1) = 12
    That said - it isn't something I ever worry about - you should always be casting your values to what is required to ensure a reliable result. 
    HTH. 
    Cheers
    LucasF

Maybe you are looking for

  • PS CS5 Fails to Print New Document

    Folks, I recently installed CS5 on a new Windows 7 64-bit computer. I subsequenly downloaded/installed the latest driver from Epson for my R340 printer. I opened a .jpg in PhotoShop and printed it with no difficulty, as did an existing .psd file crea

  • Oracle Business Rules Custom Functions

    Hi, I have an input fact with attributes A,B,C & D and an output fact with E, C & D. (C & D attributes are common in both facts) Whenever the rule matches, we are asserting new output fact by assigning a constant value to attribute 'E' and also the t

  • Movieclips -  best compression formats and filesize in general for Keynote?

    I have experienced the same problems as many others in this forum with playing QT movies in keynote. My mpeg-2 will not even import now in Leopard 10.5 and KN 4.0.1. I would likt to know if someone has tried out what QT compatible formats looks best

  • Displaying warning at the time of executing workbook

    Hi, I am executing the workbook. But it is displaying the below warning in the text box. Different hierarchies are used for  characteristic profit center. So please guide me how to overcome this not to display this warning.

  • Asha 501 can't select image for contact list

    Hi, I cannot see any option to select the image for my contacts list. Is there any software available to select this..or need to wait for the future release of asha platform 1. Appreciate your help in this regard. Solved! Go to Solution.