SQL Server: Cannot insert an explicit value into a timestamp column

后端 未结 7 2062
无人及你
无人及你 2020-11-30 09:25

When using this statement

create table demo (
    ts timestamp
)

insert into demo select current_timestamp

I get the following error:

7条回答
  •  感动是毒
    2020-11-30 10:02

    If you have a need to copy the exact same timestamp data, change the data type in the destination table from timestamp to binary(8) -- i used varbinary(8) and it worked fine.

    This obviously breaks any timestamp functionality in the destination table, so make sure you're ok with that first.

提交回复
热议问题