Timestamp
-
Friday, March 02, 2012 9:02 PM
Can someone help me understand the timestamp field. ex. timestamp=
0x0000000002FCFC8E I am attempting to insert new rows into a table with this timestamp field. How can i prog. sql to insert this timestamp fied
All Replies
-
Friday, March 02, 2012 9:04 PMModerator
You cannot program to insert a timestamp field because it is automatically assigned by the SQL Server database engine. Moreover,
EDIT:
Grrrrr. This editor gets frustrating. I thought I said something like this:
Moreover, the timestamp datatype might not be what you are expecting and is not at all like the timestamp datatype in either DB2 or Oracle. The SQL Server timestamp datatype might better be described as a "row version marker".
If you really need to record date and time I suggest using either the datetime datatype, or if you are using SQL Server 2008 you might want to consider using the datetime2 datatype.
Please describe how you are trying to use this datatype.
- Edited by Kent WaldropMicrosoft Community Contributor, Moderator Friday, March 02, 2012 9:13 PM
- Proposed As Answer by Christopher84 Friday, March 02, 2012 10:53 PM
-
Friday, March 02, 2012 9:07 PM
Hi,
the timestamp is a value that you cannot modify. It is automatically set from SQL Server whenever a row is changed.
Please see http://msdn.microsoft.com/en-us/library/ms182776(v=SQL.90).aspx for more information.
With kind regards,
Konrad
-
Friday, March 02, 2012 9:07 PMModerator
The TIMESTAMP data type is an internally calculated value and has been renamed "ROWVERSION" because of the confusion. You cannot change it. Whatever you are trying to do, you need to do it differently.
Please see: http://msdn.microsoft.com/en-us/library/ms182776.aspx
-
Friday, March 02, 2012 9:14 PM
I have a table called Item lifecycle.... I need to update (add) a bunch of these records to the current item lifecycle... but I can not figure out how to accomplish this 'mass' data load because of this field
for example
INSERT INTO ItemLifeCycle (timestamp, [Item No_], [Effective Date],[Lifecycle Status]) VALUES (?????, 1234, GetDate(),2);
-
Friday, March 02, 2012 9:21 PMModerator
Do not list or use the "timestamp" field. The value is autogenerated.
INSERT INTO ItemLifeCycle ([Item No_], [Effective Date],[Lifecycle Status]) VALUES (1234, GetDate(),2);
- Marked As Answer by SBolton Saturday, March 03, 2012 7:11 AM
-
Saturday, March 03, 2012 7:14 AM
leaving the timestamp blank did work!!.. thanks. the test DB looks great.. but... .. I was informed by our Microsoft 'Partner' that back end modifications to the Navision database violates our license.. :(
I was told to use data objects within navision instead of using a back end SQL script.. but thanks again for the help!

