home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / sybase / 647 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.9 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!olivea!sgigate!odin!bondo.corp.sgi.com!lmcgee
  2. From: lmcgee@bondo.corp.sgi.com (Lee McGee)
  3. Newsgroups: comp.databases.sybase
  4. Subject: Re: Questions sbout time based queries
  5. Message-ID: <1993Jan11.164347.5944@odin.corp.sgi.com>
  6. Date: 11 Jan 93 16:43:47 GMT
  7. References: <1ikt6eINNh61@meaddata.meaddata.com>
  8. Sender: news@odin.corp.sgi.com (Net News)
  9. Reply-To: lmcgee@sgi.com
  10. Distribution: na
  11. Organization: Silicon Graphics
  12. Lines: 33
  13. Nntp-Posting-Host: bondo.corp.sgi.com
  14.  
  15. In article <1ikt6eINNh61@meaddata.meaddata.com>, jimj@meaddata.com (Jim Johnstone) writes:
  16. |> We have a need to query out all rows entered by a given user since a specified
  17. |> time.  My first thought was to use timestamp columns in all tables. So (I am
  18. |> very new to Sybase, so please be nice) my questions are:
  19.  
  20. I have a great "horror story" for you! :^( - I once had an an application that used a timestamp column for this purpose, until one day THE TIMESTAMPS ROLLED OVER (reset back to a lower value) and EVERYTHING IN THE DATABASE GOT SELECTED!
  21.  
  22. You can't count on the sybase timestamp value as an always increasing number!
  23.  
  24. (our experience was under SQL Server 4.0.1; your mileage may vary.)
  25.  
  26. |> 1. Are timestamps the best way to go? 
  27. |> (nice because they are automatic, bad because they can't be CONVERTed)
  28. |> 
  29. |> 2. Should I just use datetime in each table?
  30. |> ... insert TABLE values(..., getdate(), ...) 
  31. |> then 
  32. |> ... select * from TABLE where date > @threshold and user = @user> 
  33.  
  34. |> 3. Is there some Sybase table/feature that will allow me to meet the 
  35. |> requirement directly?
  36. |> 
  37. |> 4. How would you handle this requirement?
  38.  
  39. Use a datetime column and a trigger to keep it updated.
  40.  
  41. -- 
  42. ________________________
  43. Lee McGee lmcgee@sgi.com            Spring is what winter
  44. Silicon Graphics, Inc                 Always goes inter.  
  45. PHONE (415) 390-2403        
  46. FAX   (415) 961-9584                   - Ogden Nash  
  47. PAGE  (415) 807-2246        
  48.