Search

Monday, April 15, 2013

Cannot insert an explicit value into a timestamp column. Use INSERT with a colimn list to exclude the timestamp column, or insert a DEFAULT into the timestamp column

You will get below error while inserting data into table with TimeStamp column:

Cannot insert an explicit value into a timestamp column. Use INSERT with a colimn list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.

The main reason for this error is timestamp data type works in the same way as identity field. You don’t need to pass the value explicitly for this fields, SQL server automatically insert the value based on the system data and time.

If you need to insert a formatted date or time then you need to use datatime data type or change the SQL query.

No comments:

Post a Comment