[thelist] SQL Server - TimeStamp

Scott Dexter dexilalolai at yahoo.com
Tue Jun 1 11:07:15 CDT 2004


--- Seshadri.Varadhan at in.efunds.com wrote:
> 
> Hi,
> I have SQL Server table with TimeStamp column. I canno insert
> values into this field. When I try to
> Insert values into this field it says the followin error.
> 
> "Server: Msg 273, Level 16, State 1, Line 1
> Cannot insert a non-null value into a timestamp column. Use INSERT
> with a column list or with a
> default of NULL for the timestamp column."


In SQL Server, "timestamp" is a datatype. When you build a table the
default datatype for a column named "timestamp" is the Timestamp
datatype. Confirm first that the datatype of the column is what you
want, then go from there. What is an example value you are trying to
insert?

>From the SQL Server Books Online:
"A table can have only one timestamp column. The value in the
timestamp column is updated every time a row containing a timestamp
column is inserted or updated. This property makes a timestamp column
a poor candidate for keys, especially primary keys. Any update made
to the row changes the timestamp value, thereby changing the key
value. If the column is in a primary key, the old key value is no
longer valid, and foreign keys referencing the old value are no
longer valid. If the table is referenced in a dynamic cursor, all
updates change the position of the rows in the cursor. If the column
is in an index key, all updates to the data row also generate updates
of the index.

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


Hope this helps--

Scott





More information about the thelist mailing list