SQL Server – ERROR – Cannot insert an explicit value into a timestamp column.

TimeStamp Column in SQL Server

TimeStamp is used to store unique binary numbers within a database. This column is autogenerated with a storage size of 8 bytes.

IF you want to store the Date and Time (e.g., updated time etc) usedatetime2 datatype instead of timestamp.

The error: "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." occurs when you try to insert the value using Insert statement.

Leaving the column in the Insert will automatically update the value:

Insert into PerformanceMaster (PerformanceID, EventID, ArtistID, PerformanceDate )
values (@PerformanceID, @EventID, @ArtistID, @UpdateDate )

Should throw and error.

Use the following instead:

Insert into PerformanceMaster (PerformanceID, EventID, ArtistID, )
values (@PerformanceID, @EventID, @ArtistID)
SOURCE

LINK (Blogspot.com)

LANGUAGE
ENGLISH