Tuesday, August 18, 2009

Cannot insert an explicit value into a timestamp column.

When creating a temporary table variable I needed to store a timestamp that was being sourced from another table. When attempting to insert that values into the timestamp column to following error message appeared:

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.

According to books online:

A nonnullable timestamp column is semantically equivalent to a binary(8) column. A nullable timestamp column is semantically equivalent to a varbinary(8) column.

So changing the column in the temporary table from timestamp to binary(8) resolved the issue.