Re: Timestamp Value - please help

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: DalePres (nospam_at_nomail.com)
Date: 05/02/04


Date: Sun, 2 May 2004 17:11:53 -0500

A timestamp value isn't really designed to be retrieved or queried against.
It is not even guaranteed to remain the same over time since each time you
change or update a row, the timestamp changes. Rows updated later will
always have a higher timestamp value than rows updated earlier. That's the
only assumption you should make. Timestamps are intended to allow you to
sort based on update time but do not represent actual times.

If you want to record row update/creation times for later retrieval, use a
datetime column with GETDATE() so that all the times are in server time.
Though not guaranteed to give as reliable of a timestamp as a timestamp
column would, in all but the most rare of situations, it would be completely
reliable and/or acceptable.

Dale

"Richard" <anonymous@discussions.microsoft.com> wrote in message
news:88F38A33-E28B-4AAE-9FC2-445F65F6BA2C@microsoft.com...
> I am using a class to store values from a query, but I have found no
documentation to show how to capture the actual value of a timestamp from a
SQL Server 2000 database table using VB.Net. I need to use the timestamp in
the Where clause of an update statement, but the value returned is
"System.Byte[]", not the actual value. Here is some of my code:
>
> 'Assume I've pulled these fields from table (TS is timestamp)
> Select EmpID, FirstName, LastName, TS From Employees
>
> Private mintEmpID As Integer
> Private mstrFN As String
> Private mstrLN As String
> 'I'm using a byte array to store the TS. Is that the right way to do it?
> Private mbytTS(8) As Byte
>
> 'Here's my data.
> With ds.Tables(0).Rows(0)
> mintEmpID = .Item("EmpID")
> mstrFN = .Item("FirstName")
> mstrLN = .Item("LastName")
> mbytTS = .Item("TS")
> End With
>
> When the user changes the data and saves, the update query using the TS in
the Where clause fails because mbytTS reads 'System.Byte[]' instead of the
actual timestamp.
>
> Private sql as String
> sql = "Update Employees Set FirstName='" & mstrFN & "', LastName='" &
mstrLN & "' Where EmpID = " & mintEmpID & " And TS =" & mybtTS
>
> I'm missing the key thing here, which is the actual timestamp value. Can
someone please tell me how to capture the timestamp into a variable, and
reference it correctly in the update query? Thank you in advance for your
help.
>



Relevant Pages

  • Re: Timestamp Value - please help
    ... The following topic in MSDN gives an example of converting hex to string. ... Private mintEmpID As Integer ... 'Pass the timestamp to conversion function. ... I retrieve the updated TS for future updates. ...
    (microsoft.public.dotnet.framework.adonet)
  • Timestamp Value - please help
    ... Private mintEmpID As Integer ... Private mstrFN As String ... When the user changes the data and saves, the update query using the TS in the Where clause fails because mbytTS reads 'System.Byte' instead of the actual timestamp. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: [PHP] Unique Object Instance ID..?
    ... private static $INSTANCES = 0; ... combining the three makes a unique id; but it's only unique to that session, no good for a real world application as there could be 50 sessions all running at the same time on the server; and odds are rather high that two instances of the object could have the same id. ... I'd thought a simple random integer would possibly be enough (combined with the timestamp), but there could still be collission. ...
    (php.general)
  • Re: [PHP] Unique Object Instance ID..?
    ... private static $INSTANCES = 0; ... combining the three makes a unique id; but it's only unique to that session, ... I'd thought a simple random integer would possibly be enough (combined with ... the timestamp), but there could still be collission. ...
    (php.general)
  • Timestamp
    ... How do you get the actual value of a timestamp from a SQL Server 2000 database table using VB.Net? ... Private mintEmpID As Integer ... Private mstrFN As String ...
    (microsoft.public.dotnet.languages.vb)