生成TABLE中每个记录的日志 [英] Generate log of every record in TABLE

查看:66
本文介绍了生成TABLE中每个记录的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SQL2008.

我想为我的表上进行的每笔交易生成日志文件.

I am using SQL2008.

I want to generate log file of each and every transaction carried out on my table.

How can i do this?

推荐答案

您可以为此使用事务日志记录:
http://www.databasedesign-resource.com/sql-server-transaction-log.html [^ ]

祝您好运!
You could use transaction logging for that:
http://www.databasedesign-resource.com/sql-server-transaction-log.html[^]

Good luck!


根据日志文件的含义,在BOL中查找 Create Trigger .它们将使您能够将更改记录到表中.
Depending on what you mean by log file, look up Create Trigger in BOL. They would enable you to log changes to a table.


简便的解决方案是...

创建另一个与您要为其记录日志的表相似的表.
添加新字段作为对记录执行的操作的类型(类似于I表示插入新项,D表示删除,D记录更新前的UD记录(执行更新操作时从已删除的表中),UN表示更新后的新记录(插入表格). />
使用该日志表来跟踪活动...等
Easy solution is...

Create another table similar to the one for which you want the log.
Add new field as Type for operation performed on the record (Like I for Insert New, D for Delete, UD REcord before update (from deleted table when update operation is performed) and UN for New record after updated (form inserted).

Use that log table to trace the activity... etc


这篇关于生成TABLE中每个记录的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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