如何在Sql Server中获取列数据的编辑部分 [英] How to Get The Edited Part of a Column's Data in Sql Server

查看:82
本文介绍了如何在Sql Server中获取列数据的编辑部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两张桌子:



1.文章(artID,artContents,artPublishDate,artCategoryID,publisherID)。



2. ArticleUpdated(upArtID,upArtContents,upArtEditedData,upArtPublishDate,upArtCategory,upArtOriginalArticleID,upPublisherID)





用户登录进入应用程序并在(artContents)列更新文章的内容。我想知道:



1.用户对文章内容做了哪些更改?



2.想要存储文章,原始版本和编辑版本的两个版本!



我应该做两件以上任务:



1.对表格进行必要的更改?



2.获取(artContents)精确编辑数据的查询。



(确切的编辑数据意味着,coloumns中可能有5000个字符,用户可以在列的中间或其他位置编辑200个字符在编辑之前和编辑之后,我想要那些编辑过的字符。





注意:我正在使用ASP.NET C#用于开发

解决方案

看看SQL 2005是否支持''触发'' - 如果要为记录更改定义触发器,则应该呈现前后图像 - 您可以将其存储在更新的表格中 - 您可能需要修改它以存储图像之前和之后,或者添加代码字段以区分它们



那么为了看看改变了什么,你可以看看之前和之后的字段,并且基本上有所不同,是吗?


你可以为我创建一个触发器该表以及如何记录和区分它与之前或最后,

请我只是新的SQL服务器,我的SQL服务器支持触发器

谢谢

I have two Tables:

1. Articles(artID, artContents, artPublishDate, artCategoryID, publisherID).

2. ArticleUpdated(upArtID, upArtContents, upArtEditedData, upArtPublishDate, upArtCategory, upArtOriginalArticleID, upPublisherID)


A user logging in to the application and update an article''s contents at (artContents) column. I want to know about:

1. Which Changes the user made to the article''s contents?

2. want to store both versions of the Article, Original version and Edited Version!

What should I do for doing above two task:

1. Any necessary changes into the tables?

2. The query for getting exact edited data of (artContents).

(The exact edited data means, that there may 5000 characters in the coloumns, the user may edit 200 characters in the middle or somewhere else in column''s characters, I want exact those edited characters, before of edit and after of edit)


Note: I am using ASP.NET with C# for Developing

解决方案

Have a look to see if SQL 2005 supports ''triggers'' - if you were to define a trigger for the record change, it should then present the before and after images - which you can store in your ''updated table'' - you might need to modify it to store both before and after images, or, add a code field to distinguish them

Then to see what was changed, you can then look at the fields n the before vs after set and basically do a difference, yes ?


can you create a trigger for me on that table and how to record and distinguish it with before or last,
please I am just new to sql server, and my sql server has support for triggers
thanks


这篇关于如何在Sql Server中获取列数据的编辑部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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