Finding Last Updated with a timestamp

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Finding Last Updated with a timestamp

    Hi All

    I know an SQL Server timestamp seems to be as useful as rocking horse for
    show jumping, but I'm hoping you know a 'fudge' to get me round a problem or
    at least confirm that it isn't possible.

    I have 2 tables, one called ACCOUNTS and one called STOCK.

    These tables have the usual ints, varchars, etc and have a timestamp field
    as well.

    My end user wants to see a simple list of the details in these tables
    (individually - no joins present here), but sorted from most recently
    updated to never touched.

    As the timestamp seems to update each time a transaction hits it I though
    this would be perfect, but I've had the following mixed results:

    1) I did a simple ORDER BY TIMESTAMP DESC, but because the order is
    alphanumeric I don't get a true 'recent to old' list.

    2) So I did ORDER BY CAST(TIMESTAMP AS INT) DESC. There is a numeric sort
    now, but the timestamp values seem to be hit and miss so that an account
    that I know should be near the top is around about the middle.

    Do you know how I can achieve the results I want?

    Is the timestamp a waste of time?

    Thanks

    Robbie


    Astra Guest

  2. Similar Questions and Discussions

    1. int4 -> unix timestamp -> sql timestamp; abstime?
      Hello, what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as...
    2. Datagrid not updated during delete, but updated during insert and update
      Hello everyone. A test webform here, single datagrid bound to one table through dataset, and controls to delete, update and insert data. The code...
    3. recursively finding file size/timestamp on a Mac / Solaris
      Hi, This is wat I'm doing... but its not working :-( find (\&wanted,"$Root"); print OUT ' </table> <p>&nbsp;</p> </body>
    4. [PHP] timestamp
      This is what I'm using so far. But I need to put in a time stamp to calculate if the visitor is new. I want to use the IP so if the ip saved in MySQL...
    5. Imported + updated symbols don't stay updated
      Hi everybody. I apologize for posting a question that probably any newbie should know, but ... I'm a rank Fireworks newbie. My problem is that the...
  3. #2

    Default Re: Finding Last Updated with a timestamp

    Please don't multi-post...

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Astra" <info@NoEmail.com> wrote in message
    news:egCYlUyaEHA.3692@TK2MSFTNGP09.phx.gbl...
    > Hi All
    >
    > I know an SQL Server timestamp seems to be as useful as rocking horse for
    > show jumping, but I'm hoping you know a 'fudge' to get me round a problem
    or
    > at least confirm that it isn't possible.
    >
    > I have 2 tables, one called ACCOUNTS and one called STOCK.
    >
    > These tables have the usual ints, varchars, etc and have a timestamp field
    > as well.
    >
    > My end user wants to see a simple list of the details in these tables
    > (individually - no joins present here), but sorted from most recently
    > updated to never touched.
    >
    > As the timestamp seems to update each time a transaction hits it I though
    > this would be perfect, but I've had the following mixed results:
    >
    > 1) I did a simple ORDER BY TIMESTAMP DESC, but because the order is
    > alphanumeric I don't get a true 'recent to old' list.
    >
    > 2) So I did ORDER BY CAST(TIMESTAMP AS INT) DESC. There is a numeric
    sort
    > now, but the timestamp values seem to be hit and miss so that an account
    > that I know should be near the top is around about the middle.
    >
    > Do you know how I can achieve the results I want?
    >
    > Is the timestamp a waste of time?
    >
    > Thanks
    >
    > Robbie
    >
    >

    Aaron [SQL Server MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139