按列比较列 [英] Column By Column Comparison

查看:115
本文介绍了按列比较列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server 2000


相同列的复制审计表。我想报告

数据之间的差异。


如何通过列列表循环?在TSQL中而不是明确地

命名每一列进行比较?


谢谢,

Craig

SQL Server 2000

I will to compare a normal table with a replicated audit table having
identical columns. I wish to report on the differences between the
data.

How can I loop though a "column list" in TSQL rather than explicitly
naming each column to compare ?

Thanks,
Craig

推荐答案

你只是想知道是否存在差异或者是什么类型的

差异?


- 对于整个表格

来自SomeTable的SELECT checksum_agg(binary_checksum(*))


- 仅适用于行

从SomeTable中选择binary_checksum(*)

如果你需要更多的granualarity,那就更多了。


HTH, Jens Suessmeyer。

Do you just want to know if there IS a difference or what sort of
difference ?

--For the Whole Table
SELECT checksum_agg(binary_checksum(*)) from SomeTable

--For just the rows
Select binary_checksum(*) from SomeTable

If you need more granualarity, then it would be more work.

HTH, Jens Suessmeyer.


Jens,


这不是100%可靠。如果校验和函数与
不同,则表格中必须存在差异,但

反之则不然。校验和函数可以在不同数据上返回

相同的值,就像任何散列函数一样。


唯一可靠的方法是逐列比较。


Steve Kass

Drew大学


Jens写道:
Jens,

This is not 100% reliable. If the checksum functions are
different, there must be a difference in the tables, but the
converse is not true. The checksum functions can return the
same values on different data, like any hash function.

The only sure way is to compare column by column values.

Steve Kass
Drew University

Jens wrote:
你只是想要要知道是否存在差异或者有什么区别?

- 对于整个表格来自SomeTable的SELECT checksum_agg(binary_checksum(*))

- 仅用于行
从SomeTable中选择binary_checksum(*)
如果你需要更多的granualarity,那么它会更有用。

HTH ,Jens Suessmeyer。
Do you just want to know if there IS a difference or what sort of
difference ?

--For the Whole Table
SELECT checksum_agg(binary_checksum(*)) from SomeTable

--For just the rows
Select binary_checksum(*) from SomeTable

If you need more granualarity, then it would be more work.

HTH, Jens Suessmeyer.



是的,我肯定同意你的意见。但正如我所说,要获得更多的b / b
粒度和更多的可靠性,你必须使用另一种机制,即
会导致更多的编码。但正如我所说,我和你在一起。


Jens Suessmeyer。

Yes I agree with you, definitely. But as I said, to have more
granularity and more reliabilty you have to use another mechanism which
causes more coding. but as I said, I am with you.

Jens Suessmeyer.


这篇关于按列比较列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆