Results 1 to 12 of 12

Thread: Round problem

  1. #1
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    Unanswered: Round problem

    Hi,

    I am using sql statement to save data in SQL SERVER but even i did not apply any round function it is automatically rounding up. e.g. 3.56 when i see it in database it is 4 how can i avoid this rounding? I am using MS Access as front end.

    Any help will be highly appreciated.
    mr_roomi

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    What's the datatype in sql server?

    Can you post the DDL of the table?

    It'll need to be something like

    decimal(15,2), float or real, numeric, money or smallmoney

    I would use decimal

    Did you ever fix your trigger?

    Damn another fluff post...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    Table structure

    Hi Brett,
    Here is table. Regarding Trigger , I could not solve it. Can you help me regarding that too?
    CREATE TABLE [dbo].[VALID_ITEM] (
    [DB_CONTRACT] [decimal](10, 0) NOT NULL ,
    [PC_CODE] [int] NOT NULL ,
    [ITEM_NO] [varchar] (7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    [NEW_ITEM] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [DESCPT] [varchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [UNITS] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [TYPE_ITEM] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [RET_PERC] [decimal](3, 0) NULL ,
    [PROJQ] [decimal](11, 3) NULL ,
    [CONTQ] [decimal](11, 3) NULL ,
    [QTD] [decimal](11, 3) NULL ,
    [TAMT_RET_ITEM] [decimal](12, 2) NULL ,
    [TAMT_PAID_ITEM] [decimal](12, 2) NULL ,
    [CONTR_PRICE] [decimal](12, 3) NULL ,
    [IND_OVR_UND] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ) ON [PRIMARY]
    mr_roomi

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Which column is rounding...but looks like you need precision...

    gotta split...I'll check it in the am

    Damn...another fluff post on my part
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    column

    Hi Brett,

    The column [QTD] [decimal](11, 3) NULL is giving problem.

    thanks
    mr_roomi

  6. #6
    Join Date
    May 2004
    Posts
    5
    You may want to look at how you are saving the data to the table. If you have access to Profiler you may want to run the SQLProfilerTSQL.tdf template and check the SQL statement passed to SQL Server. Chances are that access is rounding the value before passing it to SQL Server.

  7. #7
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    rounding

    hi,

    I checked on MS Access side, access is not rounding it. I have profiler how can i run SQLProfilerTSQL.tdf ?

    regards
    mr_roomi

  8. #8
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    Problem still there

    hi,

    any one help me about my problem?

    plzzzzzz
    mr_roomi

  9. #9
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Probably.

    Post your SQL procedure code.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  10. #10
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    code

    Hi,
    Here is the portion which is giving the problem

    declare
    @var_vendor integer,
    @var_used_amt integer

    set @var_vendor = (select gen_contr from ae_contract where db_contract=@var_db_contract)

    BEGIN
    update vendor
    set used_amt = isnull(used_amt,0) + @var_amt_result + @var_amt_ret_result where db_vendor = @var_vendor
    mr_roomi

  11. #11
    Join Date
    May 2004
    Posts
    5
    declare
    @var_vendor integer,
    @var_used_amt integer
    This portion is doing the rounding. The value that is being rounded should have a data type of decimal with precision.

    Also if you open Profiler, there is a list of templates that can show you the activity being sent to the SQL Server.

  12. #12
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    worked

    hi,

    Thank you very much..it worked...
    mr_roomi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •