在 SQL 中比较 2 行的最快方法是什么?

发布于 2024-08-28 04:09:41 字数 283 浏览 4 评论 0原文

我有两个不同的数据库。在更改大表中的某些内容(我无权访问)时,我会在数据库中的一个类似的巨大表中导入一些行。我有一项工作检查此表中的记录,如果有的话,执行存储过程,处理并从表中删除。

  1. 性能。 (大量数据)我想知道使用 2 个导入行(每行 100 列)来了解某些内容是否发生更改的最快方法是什么。没有FK-s,不需要。有可能,即使我的表中有记录,但实际上没有任何改变。

  2. 还有。假设确实发生了一些变化。例如,是否可以仅检查日期时间列内的更改?

谢谢

I have 2 different databases. Upon changing something in the big one (i don't have access to), i get some rows imported in my databases in a similar HUGE table. I have a job checking for records in this table, and if any, execute a stored procedure, process and delete from table.

  1. Performance. (Huge amount of data) I would like to know what is the fastest way to know if something has changed using let's say 2 imported rows with 100 columns each. Don't have FK-s, don't need. Chances are, that even though I have records in my table, nothing has actually changed.

  2. Also. Let's say there is actually changed something. Is it possible for example to check only for changes inside datetime columns?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彼岸花ソ最美的依靠 2024-09-04 04:09:41

您始终可以使用更新触发器 -这些将使您能够访问两个逻辑表:insertedupdated。您可以比较这些值并根据结果采取行动。

You can always use update triggers - these will give you access to two logical tables, inserted and updated. You can compare the values of these and base your action on the results.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文