表修订/历史?

编程入门 行业动态 更新时间:2024-10-18 14:13:56
本文介绍了表修订/历史?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试找出在关系数据库中保留表的历史记录/修订的最佳方法。

I'm trying to figure out the best way to keep history/revision of tables in a relational database.

我已经做了一些研究和阅读,不确定跟踪变更的最佳方法是什么。对于我的主表,我很确定自己已经准备好修订表,以进行跟踪(参见图片),但是我不确定它是关系表。

I have done some research and reading, and am not sure what would be the best way to go about keeping track of changes. For my main tables, I'm quite sure I have settled for a revision table, to keep track (see picture), but it is the relation tables that I'm not sure about. Maybe just an audit trail table holding the changes?

看看下面的示例图片,保留 movies_has_actors历史的最佳方法是什么? 表? 我不能简单地使用两个主表(电影,演员),因为我需要知道在建立关系时哪个MOVIEversion_id是活动的。如果要跟踪哪个USER添加了关系(USER表不在示例图片中),该怎么办? 我不想将所有内容保留在关系表本身中,因为这只会变得庞大而使查询变慢...![alt text] [1]

Looking at the sample picture below, what would be the best way to keep history of the movies_has_actors table? I can't simply do as with the two main tables (movies, actors), as I need to know which MOVIE revision_id that was the active one at the point of time the relation was made. And what if I want to throw in tracking of which USER added the relation (USER table not in sample picture)? I don't want to keep everything in the relation table itself, because that will just grow huge and slow down queries...![alt text][1]

总而言之,保留关系表历史记录的最佳方法是什么?

So to sum up, what is the best way to keep history of a relation table?

链接到图像:img115.imageshack.us/my.php ?image = 44623598nv1.jpg

Link to image: img115.imageshack.us/my.php?image=44623598nv1.jpg

[1]:图像

推荐答案

在SQL Server 2008中,有一个称为CDC(更改数据捕获)的新功能。 )MSDN上的CDC可以提供帮助。 CDC可以将表数据的更改记录到另一个表中,而无需编写触发器或其他机制,Change Data Capture可以将更改(如插入,更新和删除)记录到SQL Server中的表中,从而使更改的详细信息在关系型中可用格式。

In SQL Server 2008 a new feature called CDC (Change Data Capture) CDC on MSDN can help. CDC is an ability to record changes to table data into another table without writing triggers or some other mechanism, Change Data Capture records the changes like insert, update, and delete to a table in SQL server thus making the details of the changes available in relational format.

Channel9视频- channel9.msdn/posts/ashishjaiman/CDC-Change-Data-Capture-SQL-Server-2008/

Channel9 video - channel9.msdn/posts/ashishjaiman/CDC-Change-Data-Capture-SQL-Server-2008/

更多推荐

表修订/历史?

本文发布于:2023-10-24 14:19:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524161.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:历史

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!