Re: HELP! compare two SQL timestamps in C# byte arrays

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

From: Chris Barber (chris_at_blue-canoe.co.uk.NOSPAM)
Date: 09/19/04


Date: Sun, 19 Sep 2004 23:13:14 +0100

The inherent 'timestamp' for a record isn't based on time and as such to compare as being larger /
smaller than a specific date value for the purposes of saying:

    Select all records that have changed after a specific time

Is meaningless and cannot be achieved. You would have to use your own methods to implement a
specific field in the table that stores a datetime value.

I have seen the same issue querying a remote Sybase database with a 'timestamp' field - the values
are not date oriented and as such you can only detect if a record has changed by referring back to a
cached 'timestamp' value and detecting equality. Luckily in my case the database table also had a
datetime field 'lastchanged' that I could use.

Chris.

"Next" <aeverett99NOSPAM@hotmailNOJUNK.com> wrote in message
news:eqSUHgonEHA.4056@TK2MSFTNGP09.phx.gbl...
Thank you for your reply Hermit,

I have tride ToBase64String().

The problem is I am not testing for Equality. I don't want to know if they
aren't equal.

I want to know which one is larger. You can test only for equality using
strings.

Any ideas? Anyone :)

Aaron

"Hermit Dave" <hermitd.REMOVE@CAPS.AND.DOTS.hotmail.com> wrote in message
news:uxJfeXnnEHA.1248@TK2MSFTNGP09.phx.gbl...
> timestamp equivalent in c# is byte[] as you already know.
> what you could do is use convert it to base64string and compare the
string.
> use Convert.ToBase64String() to do the byte[] ==> base 64 string
> and then normal string ==
>
> --
>
> Regards,
>
> Hermit Dave
> (http://hdave.blogspot.com)
> "Next" <aeverett99NOSPAM@hotmailNOJUNK.com> wrote in message
> news:OE34dLnnEHA.2576@TK2MSFTNGP10.phx.gbl...
> > Please don't over think my question here ;) This is not for
concurrency.
> >
> > Once I get a couple of SQL timestamps into respective C# byte arrays,
> > how do convert\manipulate the arrays to something I can compare.
> >
> > I want to know which timestamp is greater and store it:
> >
> > //this is what I am trying to do:
> > if ( _ts2 > _ts1)
> > _ts1 = _ts2;
> >
> > I have been searching for litterally 3 days for an answer. I have tried
> > every conversion I could think of, but no success.
> >
> > If someone out there knows how to compare two SQL timestamp contained in
> C#
> > byte arrays and is willing to share their knowledge, I would be forever
in
> > your debt.
> >
> > Thanks in advance for any help you would give,
> > Aaron
> >
> >
>
>

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004


Relevant Pages

  • Re: SQL Server via MS Access
    ... > I am able to modify some of the records in Access, ... You need to add a TIMESTAMP column to each SQL table, ... this, by default, it codes the update to compare every field. ... Access can simply check using the TIMESTAMP column. ...
    (microsoft.public.windows.server.sbs)
  • Re: HELP! compare two SQL timestamps in C# byte arrays
    ... timestamp equivalent in c# is byteas you already know. ... what you could do is use convert it to base64string and compare the string. ... > how do convert\manipulate the arrays to something I can compare. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: comparing PE files with CRC/checksum
    ... >>My application requires the ability to compare two files using a CRC32 ... If two object files differ only in their timestamp they are ... digital fingerprint without ever modifying the binary file. ... But the bottom line is that I consider two object files identical ...
    (microsoft.public.win32.programmer.kernel)
  • Re: HELP! compare two SQL timestamps in C# byte arrays - My Solution
    ... handled in a much more efficient manner in SQL server, ... > Let me first start off with a couple of quotes from BOL:> "timestamp is a data type that exposes automatically generated binary> numbers, which are guaranteed to be unique within a database." ... > Given that the timestamp is unique in a database and represented as an> increasing number, I knew that I would somehow be able to compare> timestamps. ... > private string ByteArrayToHexString ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: HELP! compare two SQL timestamps in C# byte arrays - My Solution
    ... handled in a much more efficient manner in SQL server, ... > Let me first start off with a couple of quotes from BOL:> "timestamp is a data type that exposes automatically generated binary> numbers, which are guaranteed to be unique within a database." ... > Given that the timestamp is unique in a database and represented as an> increasing number, I knew that I would somehow be able to compare> timestamps. ... > private string ByteArrayToHexString ...
    (microsoft.public.sqlserver.programming)