SQL Server 更新时间戳列 [英] SQL Server updating a time stamp column

查看:78
本文介绍了SQL Server 更新时间戳列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的数据库中,我有一个 timestamp 列.我需要更新表中的一行并需要更新 timestamp 列.当我运行更新命令时,我得到:

In my database I have a timestamp column. I need to update a row in the table and need to update the timestamp column. When I run an update command I get:

Cannot update a timestamp column.

如何更新时间戳列?

推荐答案

你不

时间戳列会自动更新.也许您的印象是时间戳包含与时间相关的值?它不是,而只是一个数字,只要该记录中的值出现,就会更新该数字.把它想象成一个行版本号.

The timestamp column is updated automatically. Perhaps you are under the impression that timestamp contains a value relating to the time? It doesn't, but simply is a number which is updated whenever a value in that record is. Think of it like a row version number.

来自 MSDN:

时间戳数据类型只是一个递增数字并且不保留日期或时间.

The timestamp data type is just an incrementing number and does not preserve a date or a time.

这篇关于SQL Server 更新时间戳列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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