[thelist] SQL Server - TimeStamp

Joshua Olson joshua at waetech.com
Tue Jun 1 11:06:22 CDT 2004


> From: Seshadri.Varadhan at in.efunds.com
> Sent: Tuesday, June 01, 2004 4:38 AM
>
> 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."

Seshadri,

Timestamp is a special case field and you shouldn't need to update it
manually.

>From MSN:

"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."

http://msdn.microsoft.com/library/en-us/tsqlref/ts_ta-tz_6fn4.asp?frame=true

<tip type="MSSQL" author="Joshua Olson">
Bookmark this if you haven't already:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_
tsqlcon_6lyk.asp
</tip>

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/GA/
706.210.0168







More information about the thelist mailing list