azure mobile copy error

INSERT INTO [dest table]

SELECT * FROM [src table];

error syntax

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

how to table copy?

July 29th, 2015 2:16am

Hi kmsking,

The error indicates you were trying to insert a specific value into a timestamp type column.
According to MSDN, rowversion

  • 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.
  • rowversion is the synonym for the timestamp data type and is subject to the behavior of data type synonyms.

As the error message indicates, use insert with a column list to exclude the time stamp column.

CREATE TABLE [dest table]
(
col1 int,col2 int,col3 timestamp
);

INSERT INTO [dest table](COL1,COL2) SELECT 1,2 

select * from [dest table]

Btw, avoid to use * if possible, instead using the explicit column list all the time.

If you have any feedback on our support, you can click
July 29th, 2015 3:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics