禁用当前查询的更改跟踪 [英] Disable Change tracking for current query

查看:66
本文介绍了禁用当前查询的更改跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有启用更改跟踪的表:


ALTER TABLE dbo.myTable ENABLE CHANGE_TRACKING  WITH(TRACK_COLUMNS_UPDATED = OFF); 


我将所有更改的记录传输到某个存档表(更新,插入和删除)。存档表包含所有记录,直到最后一天。

完成此操作后,我想从myTable中删除旧记录但不应跟踪 - 否则下次记录也将从存档表中删除。 / p>

因此,应该在不改变跟踪影响的情况下完成此删除。我该怎么做?



如果我在删除之前禁用更改跟踪并在之后启用它,那么我将丢失其他可以同时执行的事务的所有更改。 / p>

我无法锁定整个过程的表格,因为我还包含了所有相关的表格,而且耗时太长。




解决方案

嗨simonxy,


选项更改跟踪,没有针对特定查询禁用更改数据捕获的此功能。如果您需要进一步的支持,可以将您的请求提交至
https://feedback.azure.com/ forums / 908035-sql-server


最好的问候,



I have table with enabled change tracking:

ALTER TABLE dbo.myTable ENABLE CHANGE_TRACKING  WITH (TRACK_COLUMNS_UPDATED = OFF); 

I transfer all changed records to some archive table(Updates, Inserts and Deletes). Archive table has all records until last day.
When this is done I would like to delete old records from myTable but this should not be tracked - otherwise next time records would be deleted also from archive table.

So, this delete should be done without change tracking impact. How can I do that?

If I disable change tracking before delete and enable it afterwards, then I lost all changes from other transactions which could be done in meanwhile.

I can't lock table for the entire process since I have also all related tables included and it takes too long.


解决方案

Hi simonxy,

For the option Change tracking, there is no such feature about Disable Change Data Capture for specific query. If you need further support, you could submit your request to https://feedback.azure.com/forums/908035-sql-server

Best Regards,

Will


这篇关于禁用当前查询的更改跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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