Subject | Re: [IBO] OT Pros & Cons of TimeStamp field VS Date field and Time field |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-07-20T13:21:15Z |
Gerald,
I can think of one disadvantage of using a TimeStamp field: You have to be
careful how you write your queries. If you issue a
SELECT * FROM <table> WHERE <timestampedfield> = :Parameter
you will only get those records which match exactly for the TimeStamp. You
could be in a situation where you thought of the field as a date, and
scratch your head wondering where you went wrong. Or even worse: if you
issued a
SELECT * FROM <table> WHERE <timestampedfield> <= :Parameter
you may not even notice that you didn't get all the records you wanted.
If the date is of no value by itself and you always think of it as a
combination of date and time, then go for a TimeStamp field. Otherwise, I
prefer using a separate Date field.
Set
I can think of one disadvantage of using a TimeStamp field: You have to be
careful how you write your queries. If you issue a
SELECT * FROM <table> WHERE <timestampedfield> = :Parameter
you will only get those records which match exactly for the TimeStamp. You
could be in a situation where you thought of the field as a date, and
scratch your head wondering where you went wrong. Or even worse: if you
issued a
SELECT * FROM <table> WHERE <timestampedfield> <= :Parameter
you may not even notice that you didn't get all the records you wanted.
If the date is of no value by itself and you always think of it as a
combination of date and time, then go for a TimeStamp field. Otherwise, I
prefer using a separate Date field.
Set