如何获取表行的旧数据? [英] How to get old datas of a table row?

查看:100
本文介绍了如何获取表行的旧数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改表格行?

请参阅以下内容以获取结束:



我更新行时:

  update  tTable  set 注意= < span class =code-string>'  test note 1' 其中 id = < 2014年3月13日,span class =code-digit> 100      
update tTable set 注意= ' 测试笔记5' 其中 id = 100 update tTable set 注意= ' 测试笔记9' 其中 id = 100 - 于2014-05-20





然后我需要在2014-05-14上知道[note]列的旧数据(id = 100)!!!

在我的例子中它应该是'test note 1'。

但是,当我使用CHANGETABLE()时,它只显示最后一个值。



请帮我解决这个问题。

解决方案

你的update命令每次都在同一行写入新值,更新列(如果有多个行具有相同的id,则更新所有行),并且SQL没有存储历史的机制 - 这是你必须开发的东西...

http: //msdn.microsoft.com/en-us/library/bb933994.aspx [ ^ ]

How to get old changes of a table row?
Please see below to get close:

when I update a row:

update tTable set Note='test note 1' where id = 100 -- on 2014-05-13
update tTable set Note='test note 5' where id = 100 -- on 2014-05-16
update tTable set Note='test note 9' where id = 100 -- on 2014-05-20



then I need to know old data of [note] column of a row (id=100) on 2014-05-14!!!
In my example it should be 'test note 1'.
But, when I use CHANGETABLE(), it only shows last value.

Please help me for this issue.

解决方案

Your update command wrote the new value every time on the same row, updating the column (and if there are more than one rows with the same id it updates all of them), and SQL has no mechanism to store history - that's something you have to develop...
http://msdn.microsoft.com/en-us/library/bb933994.aspx[^]


这篇关于如何获取表行的旧数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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