简体   繁体   English

Oracle & SQL 服务器数据集比较

[英]Oracle & SQL Server Dataset comparison

I am trying to do a C# dataset caparison between two datasets from two different DB's.我正在尝试在来自两个不同数据库的两个数据集之间做一个 C# 数据集。 Dataset one is from Oracle and Dataset two is from SQL Server and I'm comparing these datasets after an ETL jobs runs to move data from Oracle to SQL Server to validate the results. Dataset one is from Oracle and Dataset two is from SQL Server and I'm comparing these datasets after an ETL jobs runs to move data from Oracle to SQL Server to validate the results. Problem I'm having is that the data in SQL Server matches but the Dates are in a different format from source to destination and also decimal point rounding.我遇到的问题是 SQL 服务器中的数据匹配,但是从源到目标的日期格式不同,而且小数点四舍五入。

Has anyone got a good way to circumvent this problem.有没有人有一个很好的方法来规避这个问题。 I was thinking about changing my queries from the source and destination tables that fill the Dataset to format the dates etc... so the comparison would be easier but I wanted to see was there any other way?我正在考虑从填充数据集的源表和目标表中更改我的查询以格式化日期等......所以比较会更容易,但我想看看还有其他方法吗?

For the date formats set the NLS_DATE_FORMAT environment variable to the desired format.对于日期格式,将 NLS_DATE_FORMAT 环境变量设置为所需的格式。 This assumes that you catch the data in a string.这假设您捕获字符串中的数据。 Oracle will format the date to the format you specified. Oracle 会将日期格式化为您指定的格式。 For the decimal point rounding I don't get it.对于小数点四舍五入,我不明白。 Those numbers should be the same.这些数字应该是相同的。 In case you get a decimal point and want a comma, use NLS_MUMERIC_CHARACTERS 'DG' to choose which character to use a Decimal point or Group separator.如果您得到一个小数点并想要一个逗号,请使用 NLS_MUMERIC_CHARACTERS 'DG' 来选择要使用小数点或组分隔符的字符。

For example '.,' selects a '.'例如 '.,' 选择一个 '.' for decimal point and a comma for group separator.小数点和逗号作为组分隔符。

The environment variables can be set from the clients OS and also from within the Oracle session.环境变量可以从客户端操作系统设置,也可以从 Oracle session 中设置。 To do this, issue alter session set nls_date_format = 'YYYYMMDDHH24MISS';为此,请发出alter session set nls_date_format = 'YYYYMMDDHH24MISS'; or whatever format suits you best.或任何最适合您的格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM