Problem with Store Procedure Decimal Output Parameter

4 posts, 0 answers
  1. Rob
    Rob avatar
    9 posts
    Member since:
    Nov 2012

    Posted 11 Feb 2014 Link to this post

    I've run into an issue when using a stored procedure that contains OUTPUT parameters of a decimal (or money) data type...it appears the value is getting converted to an integer and removing any decimal places (although it does round as per a convert)

    Here is a simple SP that I used for testing:

    CREATE PROCEDURE [dbo].[usp_Telerik_Test]
        @curTestAmount  DECIMAL(18,2) OUTPUT
    AS
    BEGIN
        -- SET NOCOUNT ON added to prevent extra result sets from
        -- interfering with SELECT statements.
        SET NOCOUNT ON;
     
        SET @curTestAmount = 1234.55
    END
    GO

    Added to the Domain Model and executing it with the following:

    decimal? curTestAmount = null;
    this.CurrentDataSource.Usp_Telerik_Test(ref curTestAmount);

    Returns a value of 1235

    If I initialise the curTestAmount to 999999999999.99 then the result is returned successfully as 1234.55, interestingly if I initialise it to 1111.1 then the returned value is 1234.6...also if I initialise it to 111.11 an 'Error converting data type decimal to numeric.' error is thrown on the ExecuteNonQuery call in the EntitiesModel.cs!

    Let me know if you would like any further information.

    Kind Regards,

    Rob

  2. Boris Georgiev
    Admin
    Boris Georgiev avatar
    190 posts

    Posted 14 Feb 2014 Link to this post

    Hi Rob,

    First I would like to apologize for the inconvenience caused. It seems this is an issue on our side.

    The problem occurs, because Telerik Data Access is getting the result shape precision and scale based on the input parameter, instead of the stored procedure. This is the reason when the parameter is 999999999999.99 - with precision 14 and scale 2, the result is the correct. When the parameter is null - 0 for precision and 0 for scale, the result is round to integer and when the result is 111.11 - 5 for precision and 2 for scale the exception is thrown, because the result has bigger precision.

    If it is applicable for you, as a workaround, I would recommend you to pass a parameter with big enough precision and scale.

    Find your Telerik Points updated for the new bug you have helped us identify.

    We will notify you in this thread when a build containing the fix is available.

    Regards,
    Boris Georgiev
    Telerik
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
  3. DevCraft banner
  4. Rob
    Rob avatar
    9 posts
    Member since:
    Nov 2012

    Posted 23 Feb 2014 Link to this post

    Thanks for the update Boris, I'll keep a look out for the update.

    For your info, no Telerik points have appear in my account.

    Cheers,

    Rob.

  5. Boris Georgiev
    Admin
    Boris Georgiev avatar
    190 posts

    Posted 26 Feb 2014 Link to this post

    Hello Rob,

    Please accept my apologies for the omission. Your Telerik points have been updated.

    Regards,
    Boris Georgiev
    Telerik
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top