使用此语句时
create table demo ( ts timestamp ) insert into demo select current_timestamp我收到以下错误:
无法将明确的值插入到timestamp列中.将INSERT与列列表一起使用以排除timestamp列,或在timestamp列中插入DEFAULT
Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column
如何将当前时间插入timestamp列?
How do I insert the current time to a timestamp column?
推荐答案根据MSDN ,timestamp
是公开自动生成的唯一二进制数据的数据类型 数据库中的数字.时间戳通常用作一种机制 用于版本标记表行.存储大小为8个字节.这 时间戳数据类型只是一个递增的数字,而不是 保存日期或时间.要记录日期或时间,请使用datetime 数据类型.
Is a data type that exposes automatically generated, unique binary numbers within a database. timestamp is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The timestamp data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime data type.
您可能正在寻找datetime数据类型.
You're probably looking for the datetime data type instead.
更多推荐
SQL Server:无法将显式值插入时间戳列
发布评论