有人知道比较 ad hoc SQL 查询的方法/工具吗?
我必须将大量遗留 SQL 查询转换为存储过程(重写和整理),并且我正在寻找一种有效的方法来逐一比较结果,以确保我没有修改行为。我目前使用 SQLDelta,但它要求我将每个查询的结果通过管道传输到表中,并使用 SSIS 将其传输到单独的服务器。这是因为 SQL Delta 旨在比较数据库/表而不是数据集。它不会比较同一数据库中的表。
我真正想知道的是,是否有人有方法/工具以 SQLDelta 方式比较临时查询结果(即,匹配 PK 上的匹配行、突出显示差异、间隔结果以显示每组中的附加/缺失行) 。理想情况下,我会将 SQL 前后粘贴并生成结果。结果集可以是 ~10 到 200k 行和 ~50 列。
不敢相信我无法通过谷歌找到类似的东西。任何帮助表示赞赏。
谢谢
I have to convert a lot of legacy SQL queries to stored procs (rewriting and tidying) and I'm looking for an efficient way to compare the results one by one to ensure I haven't modified the behaviour. I currently use SQLDelta but it requires me to pipe the results of each query into tables and transfer one to a separate server using SSIS. This is because SQL Delta is geared around comparing databases / tables rather than data sets. It won't compare tables in the same DB.
Really what I want to know is does anyone have a method / tool to compare ad hoc query results in a SQLDelta manner (that is, matching up matching rows on PK, highlighting differences, spacing results to show additional / missing rows in each set). Ideally I'd paste the before and after SQL in and generate the results. Results sets can be ~10 to 200k rows and ~50 columns.
Can't believe I can't find something along these lines via google. Any help appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种低技术方法是将每个结果输出到文件(SQL Manager 有一个“结果到文件”按钮)并使用 diff 工具,例如 乌龟合并。
编辑
如果您从未以文本形式从 sql Manager 中提取结果,它将以表格格式显示。
只要查询是有序的。您所要做的就是打开 Tortoise merge 并查找文件中的红点。如果没有,你就可以走了。
One low tech way would be to output the results of each to a file, (SQL Manager has a 'Results to file' button) and use a diff tool like tortoise merge.
Edit
If you have never pulled results from sql Manager as text it comes out in a tabular format.
As long as the queries are ordered. All you have to do is open Tortoise merge and look for red spots in the files. If there aren't any you are good to go.