Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transforming MS-SQL money datatype to PostgreSQL numeric(19, 4) datatype. #1582

Open
olegrost opened this issue May 14, 2024 · 0 comments
Open

Comments

@olegrost
Copy link

When loading from ms-sql, the values in columns of the money type are distorted.
Source data (ms):
price (money) prc (money)
296685,43 0,6116

  1. What I did:

LOAD DATABASE
from mssql://user:password@mssqlserver/src_db
into pgsql://user:password@pgserver/trg_db

WITH create no tables, include no drop, data only, truncate
SET PostgreSQL PARAMETERS maintenance_work_mem to '4096000', work_mem to '16384'
INCLUDING ONLY TABLE NAMES like 'Tbl_To_Load' in SCHEMA 'dbo'
ALTER SCHEMA 'dbo' RENAME TO 'shc';

  1. result I got
    Dest data (ms):
    price (money) prc (money)
    296685,44 0,6116

  2. how the result is not what you expected.
    The result is different due to incorrect rounding of the source datatype "money" (before converting to the destination type numeric for PostgreSQL) to 2 decimal places.
    After using the MSSql Money Type - Value is not correct #1494 I got the following result:
    Dest data (ms):
    price (money) prc (money)
    296685,43 0,61

What do I need to do to get an exact copy of the money datatype values from MS_SQL Server?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant