Data Type Money is adding extra zero

  • Trying to copy one table to another in sql 2012, data type was set before me. Strangely, my end result have 10 times more money. I.e 27152555833.00 would appear as 271525558330.00 in end column?

    The tables are identical, anybody have any idea why it would happen?

  • how did you copy the data ? (statement please)

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • I thought you'd never ask! #Lady from Glee 😛

    INSERT INTO [IPTS_Staging].[dbo].[FactSectorKPIHist]

    ([Prospect]

    ,[OutstandingApplication]

    ,[Approved_AwaitingML]

    ,[ApprovedforKPIs]

    ,[HistDate])

    SELECT

    [Prospect]

    ,[OutstandingApplication]

    ,[Approved_AwaitingML]

    ,[ApprovedforKPIs]

    ,GETDATE()-1

    FROM [IPTS_DW].[dbo].[FactSectorKPI]

    And table:

    CREATE TABLE [dbo].[FactSectorKPIHist](

    [Prospect] [money] NULL,

    [OutstandingApplication] [money] NULL,

    [Approved_AwaitingML] [money] NULL,

    [ApprovedforKPIs] [money] NULL,

    [HistDate] [datetime] NULL

    ) ON [PRIMARY]

    GO

  • hard to believe that's the query that multiplied your [money] numbers by 10 :crazy:

    Does your source table also use the money data type for these columns ?

    Can you repro the case ?

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • ALZDBA (9/11/2013)


    Can you repro the case ?

    I'm interested in hearing the answer to this so I can use it on my bank account.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Dehqon D. (9/11/2013)


    Trying to copy one table to another in sql 2012, data type was set before me. Strangely, my end result have 10 times more money. I.e 27152555833.00 would appear as 271525558330.00 in end column?

    The tables are identical, anybody have any idea why it would happen?

    Could there be a trigger on the target table messing with your head?


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • I thought finally found SQL Server bug 🙂 but no, it was another package that was messing with my end table. So, Dwain, it's safe to use Money type.

    Thanks to all!

  • thank you for the feedback.

    everybody at ease now :hehe:

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply